From: Phil Sutter Date: Thu, 24 Aug 2017 09:51:46 +0000 (+0200) Subject: lib/fs: Fix format string in find_fs_mount() X-Git-Tag: v4.13.0~30 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=eab450789829e33a64dbd08dced3438d580d5179;p=thirdparty%2Fiproute2.git lib/fs: Fix format string in find_fs_mount() A field width of 4096 allows fscanf() to store that amount of characters into the given buffer, though that doesn't include the terminating NULL byte. Decrease the value by one to leave space for it. Signed-off-by: Phil Sutter --- diff --git a/lib/fs.c b/lib/fs.c index c59ac5645..1ff881ecf 100644 --- a/lib/fs.c +++ b/lib/fs.c @@ -45,7 +45,7 @@ static char *find_fs_mount(const char *fs_to_find) return NULL; } - while (fscanf(fp, "%*s %4096s %127s %*s %*d %*d\n", + while (fscanf(fp, "%*s %4095s %127s %*s %*d %*d\n", path, fstype) == 2) { if (strcmp(fstype, fs_to_find) == 0) { mnt = strdup(path);