From 7fd2651f67a43fad3cc1cc2db7c0e5f9c568023c Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Mon, 1 Sep 2008 09:38:32 -0400 Subject: [PATCH] libe2p: Fix potential core-dumping bug in iterate_on_dir() iterate_on_dir() can try to copy too much data from the directory entry, resulting in a crash. Signed-off-by: "Theodore Ts'o" --- lib/e2p/iod.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/e2p/iod.c b/lib/e2p/iod.c index 2c675b9..1edfc4f 100644 --- a/lib/e2p/iod.c +++ b/lib/e2p/iod.c @@ -56,12 +56,12 @@ int iterate_on_dir (const char * dir_name, return -1; } while ((dep = readdir (dir))) { - len = sizeof(struct dirent); #ifdef HAVE_RECLEN_DIRENT - if (len < dep->d_reclen) - len = dep->d_reclen; + len = dep->d_reclen; if (len > max_len) len = max_len; +#else + len = sizeof(struct dirent); #endif memcpy(de, dep, len); if ((*func)(dir_name, de, private)) -- 1.8.3.1