Re: [PATCH] Fix DMI uuid parsing.

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

 



On 07/30/10 - 04:35:27PM, Daniel Veillard wrote:
> On Fri, Jul 30, 2010 at 10:22:20AM -0400, Chris Lalancette wrote:
> > valgrind was complaining that virUUIDParse was depending on
> > an uninitialized value.  Indeed it was; virSetHostUUIDStr()
> > didn't initialize the dmiuuid buffer to 0's, meaning that
> > anything after the string read from /sys was uninitialized.
> > Clear out the dmiuuid buffer before use, and make sure to
> > always leave a \0 at the end.
> > 
> > Signed-off-by: Chris Lalancette <clalance@xxxxxxxxxx>
> > ---
> >  src/util/uuid.c |    3 ++-
> >  1 files changed, 2 insertions(+), 1 deletions(-)
> > 
> > diff --git a/src/util/uuid.c b/src/util/uuid.c
> > index f188148..9cafc2a 100644
> > --- a/src/util/uuid.c
> > +++ b/src/util/uuid.c
> > @@ -286,7 +286,8 @@ virSetHostUUIDStr(const char *uuid)
> >          return EEXIST;
> >  
> >      if (!uuid) {
> > -        if (!getDMISystemUUID(dmiuuid, sizeof(dmiuuid))) {
> > +        memset(dmiuuid, 0, sizeof(dmiuuid));
> > +        if (!getDMISystemUUID(dmiuuid, sizeof(dmiuuid) - 1)) {
> >              if (!virUUIDParse(dmiuuid, host_uuid))
> >                  return 0;
> >          }
> 
>   ACK,

Thanks, pushed.

-- 
Chris Lalancette

--
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]