autofs-5.1.2 - Fix fgets(3) size argument (another one) From: Tomohiro Kusumi 1. fgets(3) reads at most 1 less then the size argument. 2. Each line of /proc/filesystem isn't a filesystem path. So it doesn't really matter if the size argument is PATH_MAX-1 or PATH_MAX (=sizeof(buf)) as long as the buffer is large enough. We can just use sizeof(buf). Signed-off-by: Tomohiro Kusumi Signed-off-by: Ian Kent --- CHANGELOG | 1 + daemon/module.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index a0a2c46..28e857f 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -11,6 +11,7 @@ xx/xx/2016 autofs-5.1.3 - fix file map changed check. - Remove unused local 2KB buffer. - Fix typos in error messages. +- Fix fgets(3) size argument (another one). 15/06/2016 autofs-5.1.2 ======================= diff --git a/daemon/module.c b/daemon/module.c index db01db8..8879b64 100644 --- a/daemon/module.c +++ b/daemon/module.c @@ -38,7 +38,7 @@ int load_autofs4_module(void) return 0; } - while (fgets(buf, PATH_MAX - 1, fp)) { + while (fgets(buf, sizeof(buf), fp)) { if (strstr(buf, "autofs")) { fclose(fp); return 1;