瀏覽代碼

libcompat: Do not NULL-terminate the list in scandir()

This might cause a segfault in case all entries have been filtered and
list has not been allocated. This should only possibly affect systems
where the fallback code is being used.
Guillem Jover 12 年之前
父節點
當前提交
f470bfb33f
共有 2 個文件被更改,包括 2 次插入1 次删除
  1. 2 0
      debian/changelog
  2. 0 1
      lib/compat/scandir.c

+ 2 - 0
debian/changelog

@@ -75,6 +75,8 @@ dpkg (1.17.2) UNRELEASED; urgency=low
     describing in the man page the default output files.
   * Use “hyphen” instead of “dash” when we mean the ‘-’ character in the
     documentation and code comments.
+  * Do not NULL-terminate the list in the compat scandir(), as this might
+    cause a segfault in case the function returns 0 entries.
 
   [ Updated programs translations ]
   * German (Sven Joachim).

+ 0 - 1
lib/compat/scandir.c

@@ -85,7 +85,6 @@ scandir(const char *dir, struct dirent ***namelist,
 		list[used] = m;
 		used++;
 	}
-	list[used] = NULL;
 
 	closedir(d);