[Reproducible-commits] [dpkg] 14/25: libcompat: Do not run qsort over the scandir list if it is NULL

Holger Levsen holger at layer-acht.org
Tue May 3 08:43:55 UTC 2016


This is an automated email from the git hooks/post-receive script.

holger pushed a commit to annotated tag 1.16.16
in repository dpkg.

commit 71ef94898b7da381afe2c09a20b5bb19d030d375
Author: Guillem Jover <guillem at debian.org>
Date:   Sat Jun 7 12:41:23 2014 +0200

    libcompat: Do not run qsort over the scandir list if it is NULL
    
    Cherry picked from commit 75a93afbe53d6d2554ed87abeb794a75373156fd.
    
    Warned-by: coverity
---
 debian/changelog     | 1 +
 lib/compat/scandir.c | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/debian/changelog b/debian/changelog
index 62487a4..930ffe6 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -13,6 +13,7 @@ dpkg (1.16.15+nmu1) UNRELEASED; urgency=low
     introduced with the initial triggers implementation in dpkg 1.14.17.
     Closes: #751021
   * Fix a descriptor leak on dselect subprocesses when --debug is used.
+  * Do not run qsort() over the scandir() list in libcompat if it is NULL.
 
   [ Updated scripts translations ]
   * Fix typos in German (Helge Kreutzmann)
diff --git a/lib/compat/scandir.c b/lib/compat/scandir.c
index c38ae01..914a559 100644
--- a/lib/compat/scandir.c
+++ b/lib/compat/scandir.c
@@ -88,7 +88,7 @@ scandir(const char *dir, struct dirent ***namelist,
 
 	closedir(d);
 
-	if (cmp != NULL)
+	if (list != NULL && cmp != NULL)
 		qsort(list, used, sizeof(struct dirent *), cmp);
 
 	*namelist = list;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/dpkg.git



More information about the Reproducible-commits mailing list