[Spice-devel] [spice-server v2 2/2] stat: Move NULL check earlier in stat_file_add_node()
Christophe Fergeau
cfergeau at redhat.com
Tue Jan 24 12:15:11 UTC 2017
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20170124/768a1b0e/attachment.sig>
More information about the Spice-devel
mailing list