diff options
author | Phillip Lougher <phillip@squashfs.org.uk> | 2014-04-18 01:37:54 +0100 |
---|---|---|
committer | Phillip Lougher <phillip@squashfs.org.uk> | 2014-04-18 04:04:19 +0100 |
commit | 8456ad7f373479f0e1b06f077c663f052f50dc49 (patch) | |
tree | 8f5bad54755300e477329ba16727615408d259b8 | |
parent | dd176ec9a3fcc38afe26f4c50310775b190d102d (diff) | |
download | squashfs-tools-8456ad7f373479f0e1b06f077c663f052f50dc49.tar.gz |
mksquashfs: sort_directory(), silence bogus cur NULL pointer dereference
Static analysis reports a cur NULL pointer dereference
at the cur->next=NULL line.
This is because static analysis is too stupid to realise we'll
always go around the loop at least once, assigning cur, iff
dir->count > 1, which is checked for. In otherwords it does
not correlate dir->count > 1 with the fact dir->list will always
be non NULL.
Even though it is strictly unnecessary, it is easily to silence
static analysers by checking for dir->list == NULL as well as
dir->count > 1.
Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
-rw-r--r-- | squashfs-tools/mksquashfs.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/squashfs-tools/mksquashfs.c b/squashfs-tools/mksquashfs.c index 9648805..8a6ddb0 100644 --- a/squashfs-tools/mksquashfs.c +++ b/squashfs-tools/mksquashfs.c @@ -3654,7 +3654,7 @@ void sort_directory(struct dir_info *dir) struct dir_ent *cur, *l1, *l2, *next; int len1, len2, stride = 1; - if(dir->count < 2) + if(dir->list == NULL || dir->count < 2) return; /* |