Просмотр исходного кода

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
Родитель
Сommit
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.
     describing in the man page the default output files.
   * Use “hyphen” instead of “dash” when we mean the ‘-’ character in the
   * Use “hyphen” instead of “dash” when we mean the ‘-’ character in the
     documentation and code comments.
     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 ]
   [ Updated programs translations ]
   * German (Sven Joachim).
   * German (Sven Joachim).

+ 0 - 1
lib/compat/scandir.c

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