From: Tobias Stoeckmann Date: Wed, 14 Aug 2024 15:40:40 +0000 (+0200) Subject: depmod: Fix out of boundary write with long paths X-Git-Tag: v34~516 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8116f06614886209a66ad421125191c03f94f478;p=thirdparty%2Fkmod.git depmod: Fix out of boundary write with long paths If a root path is specified which is PATH_MAX - 1 characters long and option -A is specified, then depfile_up_to_date_dir triggers an out of boundary write during slash addition. Signed-off-by: Tobias Stoeckmann Signed-off-by: Lucas De Marchi --- diff --git a/tools/depmod.c b/tools/depmod.c index bd9df207..78ab2076 100644 --- a/tools/depmod.c +++ b/tools/depmod.c @@ -2855,7 +2855,7 @@ static int depfile_up_to_date_dir(DIR *d, time_t mtime, size_t baselen, char *pa /* uptodate: 1, outdated: 0, errors < 0 */ static int depfile_up_to_date(const char *dirname) { - char path[PATH_MAX]; + char path[PATH_MAX + 1]; DIR *d = opendir(dirname); struct stat st; size_t baselen;