[prev in list] [next in list] [prev in thread] [next in thread]
List: autofs
Subject: [PATCH 3/3] autofs-5.1.2 - Fix fgets(3) size argument (another one)
From: Tomohiro Kusumi <kusumi.tomohiro () gmail ! com>
Date: 2016-07-30 4:36:02
Message-ID: 1469853339-2291-3-git-send-email-kusumi.tomohiro () gmail ! com
[Download RAW message or body]
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 <kusumi.tomohiro@xxxxxxxxx>
---
daemon/module.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/daemon/module.c b/daemon/module.c
index bed8f7a..6cf7b7b 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;
--
2.5.5
--
To unsubscribe from this list: send the line "unsubscribe autofs" in
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic