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

Re: [libvirt] PATCH: Fix misc memory alloc/free/usage bugs



On Tue, Mar 31, 2009 at 12:04:00PM +0200, Daniel Veillard wrote:
> On Mon, Mar 30, 2009 at 11:41:20PM +0900, Ryota Ozaki wrote:
> > Hi Daniel,
> > 
> > On Mon, Mar 30, 2009 at 10:39 PM, Daniel P. Berrange
> > <berrange redhat com> wrote:
> > > A few more small bugs
> > >
> > >  * src/node_device.c: Don't strdup() a NULL device parent
> > >  * src/qemu_conf.c: Don't try to run access() on a NULL binary path
> > >  * src/security_selinux.c Make sure result from readlink() is NULL
> > >   terminated
> > >  * src/storage_conf.c: DOn't free 'mode' while it is still used
> 
>   Patch looks fine, with the exception
> 
> [...]
> > > +++ b/src/security_selinux.c    Mon Mar 30 14:37:45 2009 +0100
> > > @@ -303,11 +303,13 @@ SELinuxRestoreSecurityImageLabel(virConn
> > >         return -1;
> > >
> > >     if (S_ISLNK(buf.st_mode)) {
> > > +        int n;
> > >         if (VIR_ALLOC_N(newpath, buf.st_size + 1) < 0)
> > >             return -1;
> > >
> > > -        if (readlink(path, newpath, buf.st_size) < 0)
> > > +        if ((n =readlink(path, newpath, buf.st_size)) < 0)
> > >             goto err;
> > > +        buf.st_size[n] = '\0';
> >            newpath[n] = '\0';
> > 
> > correct?
> 
>   Yup, I doubt it would compile otherwise :-)

Yep, I've just realized I made this change on a machine where the
selinux driver was disabled, so will update this chunk

Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|


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