Re: [PATCH] logging: fix off-by-one bug

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

 



On Mon, Mar 21, 2011 at 10:24:05AM -0600, Eric Blake wrote:
> On 03/21/2011 02:20 AM, Daniel Veillard wrote:
> > On Fri, Mar 18, 2011 at 08:31:22PM -0600, Eric Blake wrote:
> >  Well, I tend to prefer having a 0 at the end of character arrays
> > in C, this can be useful for example when debugging, so slightly
> > preferring one extra byte malloc for safety, either way not a big
> > deal, but let's fix this,
> 
> I see two ways to do things - either malloc an extra byte (which will
> always be NUL from the malloc, so deleting 'virLogBuffer[virLogSize] =
> 0' is still okay), or by touching the rest of the code to always leave
> virLogBuffer[virLogSize-1] as NUL (more invasive, and caps the useful
> log to virLogSize-1).  Do you want me to prepare a followup patch, and
> if so, for which of those two options?

  it's really a minor issue, malloc'ing an extra byte sounds fine to me.

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel@xxxxxxxxxxxx  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]