[ovs-dev] [PATCH 1/8] ofproto: Add user-specifiable datapath description (OpenFlow 1.0)

Ben Pfaff blp at nicira.com
Fri Jan 22 17:40:04 UTC 2010


On Fri, Jan 22, 2010 at 09:17:16AM -0800, Ben Pfaff wrote:
> On Fri, Jan 22, 2010 at 01:09:06AM -0800, Justin Pettit wrote:
> > In OpenFlow 1.0, a "dp_desc" character array was added to the ofp_desc_stats
> > structure that allows a human readable description of the datapath to be
> > provided.
> 
> It looks OK relative to what's there now, but I think that we have a
> memory leak since ofproto_destroy() does not free manufacturer,
> hardware, software, serial, or dp_desc.  Am I right about that?  If so,
> would you mind fixing that at the same time?

One more thing: in ofp_desc_stats_reply(), it looks like there's nothing
that guarantees that the strings are actually null-terminated, so we
could end up reading past the end of the buffer.

We can fix that by changing, e.g.
    ds_put_format(string, "Manufacturer: %s\n", ods->mfr_desc);
to
    ds_put_format(string, "Manufacturer: %.*s\n",
                  (int) sizeof ods->mfr_desc, ods->mfr_desc);




More information about the dev mailing list