[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] tools: misc: xen-tmem-list-parse: fix output ugliness



> From: Ian Jackson [mailto:Ian.Jackson@xxxxxxxxxxxxx]
> Sent: Tuesday, November 22, 2011 10:22 AM
> To: Dan Magenheimer
> Cc: stefano.stabellini@xxxxxxxxxxxxx; xen-devel@xxxxxxxxxxxxxxxxxxx
> Subject: Re: [Xen-devel] [PATCH] tools: misc: xen-tmem-list-parse: fix output 
> ugliness
> 
> Dan Magenheimer writes ("[Xen-devel] [PATCH] tools: misc: 
> xen-tmem-list-parse: fix output ugliness"):
> > (This should apply cleanly to 4.0, 4.1, and unstable.  It would
> > be nice to apply to the next dot release of 4.0 and 4.1, but
> > please definitely apply at least to unstable.)
> >
> > Fix ugly parse output for xen-tmem-list-parse
> >
> > This program parses the output of xm/xl tmem-list into
> > human-readable format.  A missing NULL terminator sometimes
> > causes garbage to be spewed where the two-letter pool type
> > should be printed.
> >
> > Signed-off-by: Dan Magenheimer <dan.magenheimer@xxxxxxxxxx>
> >
> > diff -r 54a5e994a241 tools/misc/xen-tmem-list-parse.c
> > --- a/tools/misc/xen-tmem-list-parse.c      Wed Nov 02 17:09:09 2011 +0000
> > +++ b/tools/misc/xen-tmem-list-parse.c      Wed Nov 09 14:28:40 2011 -0700
> > @@ -64,6 +64,7 @@
> >          return;
> >      for ( i = 0; i < len; i++ )
> >          *buf++ = *s1++;
> > +    *buf = '\0';
> >  }
> 
> This has a buffer overrun AFAICT.
> 
> Ian.

No, it doesn't.  I agree it *could* if parse_string is
used/called differently.  The caller simply needs to
ensure that the declared buffer is at least one larger
than the data to be matched which is true for both
callers.

P.S. Please note that I am still not receiving email
from the xen-devel reflector (and am on vacation this
week so probably won't be looking into it... my best
guess is that the Oracle spam filter isn't happy with
the new source of the xen-devel messages, as some
other Oracle folk are having problems too).


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.