diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2013-09-29 14:40:58 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2013-09-29 15:28:35 +0200 |
commit | 893fa014de0f73337ff4a4c9c531d6789b72f5bf (patch) | |
tree | 28c78bdea72bff0e109e095181a9c8b6cef6004f /src/test | |
parent | 8083d486d0ac8e159b2d1294c8f6be7b11f9cab6 (diff) |
Fix buffer overrun when enumerating files
https://bugs.freedesktop.org/show_bug.cgi?id=69887
Based-on-a-patch-by: Hans Petter Jansson <hpj@copyleft.no>
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/test-util.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/test/test-util.c b/src/test/test-util.c index ad13d53de3..c5762ede4b 100644 --- a/src/test/test-util.c +++ b/src/test/test-util.c @@ -27,6 +27,7 @@ #include <errno.h> #include "util.h" +#include "strv.h" static void test_streq_ptr(void) { assert_se(streq_ptr(NULL, NULL)); @@ -582,6 +583,14 @@ static void test_fstab_node_to_udev_node(void) { free(n); } +static void test_get_files_in_directory(void) { + _cleanup_strv_free_ char **l = NULL, **t = NULL; + + assert_se(get_files_in_directory("/tmp", &l) >= 0); + assert_se(get_files_in_directory(".", &l) >= 0); + assert_se(get_files_in_directory(".", NULL) >= 0); +} + int main(int argc, char *argv[]) { test_streq_ptr(); test_first_word(); @@ -618,6 +627,7 @@ int main(int argc, char *argv[]) { test_parse_user_at_host(); test_split_pair(); test_fstab_node_to_udev_node(); + test_get_files_in_directory(); return 0; } |