[ovs-dev] [PATCH 4/4] ofproto: Always terminate OpenFlow description strings
Justin Pettit
jpettit at nicira.com
Wed Feb 3 02:41:08 UTC 2010
On Feb 2, 2010, at 3:04 PM, Ben Pfaff wrote:
>> There is a spot where it could be interpreted otherwise. In any case,
>> I'll seek consensus on the openflow-spec mailing list. If they are
>> supposed to be null-terminated, do you still object to my
>> implementation? The start_stats_reply() function should zero out the
>> unused portion of the message, so it's still padded to the right with
>> null bytes.
>
> I don't see where start_stats_reply() zeroes out the unused portion of
> the message. It calls make_stats_reply(), which calls
> put_openflow_xid() with sizeof(struct ofp_stats_reply), which just
> zeroes out that much of the buffer. And append_stats_reply() just uses
> ofpbuf_put_uninit(), so I don't see it happening there.
Whoops, you're right. I had quickly looked through the code and I read the first argument of put_openflow_xid() as including "body_len", which would have zeroed out the bytes.
> If you make sure that the buffer is zeroed out one way or another, then
> ovs_strlcpy() is fine by me.
I'll make sure the code does that.
Thanks.
--Justin
More information about the dev
mailing list