Re: [spice-server v2 2/2] stat: Move NULL check earlier in stat_file_add_node()

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

 



On Tue, Jan 24, 2017 at 06:41:04AM -0500, Frediano Ziglio wrote:
> > 
> > stat_file->stat has already been dereferenced by the time the check is
> > done. This commit moves it earlier, before the first dereference
> > attempt.
> > ---
> >  server/stat-file.c | 8 +++++++-
> >  1 file changed, 7 insertions(+), 1 deletion(-)
> > 
> > diff --git a/server/stat-file.c b/server/stat-file.c
> > index de455b6..2e9df22 100644
> > --- a/server/stat-file.c
> > +++ b/server/stat-file.c
> > @@ -151,6 +151,12 @@ stat_file_add_node(RedStatFile *stat_file, StatNodeRef
> > parent, const char *name,
> >          return INVALID_STAT_REF;
> >      }
> >      pthread_mutex_lock(&stat_file->lock);
> > +
> > +    if ((stat_file->stat == NULL) || (strlen(name) >= sizeof(node->name))) {
> 
> name is already checked some lines above, should be

right, sorry, was just some in-progress work, but did not look closely
enough before sending :(


Christophe

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]