fusermount: Reject invalid negative mount_max in fuse.conf

mount_max is parsed with %i (signed) from /etc/fuse.conf. The value
-1 is the documented sentinel for "no limit", but any other negative
value (e.g., -2 from a typo) passes the mount_max != -1 guard and
makes the mount_count >= mount_max comparison always true, blocking
all non-root FUSE mounts.

Reject values below -1 with a warning rather than silently accepting
them.

Signed-off-by: Abhinav Agarwal <abhinavagarwal1996@gmail.com>
This commit is contained in:
Abhinav Agarwal
2026-04-15 11:58:55 -07:00
committed by Bernd Schubert
parent 8eda8f9566
commit 5e3f016bef
+7 -1
View File
@@ -192,8 +192,14 @@ static void parse_line(const char *line, int linenum, const char *progname)
if (strcmp(line, "user_allow_other") == 0)
user_allow_other = 1;
else if (sscanf(line, "mount_max = %i", &tmp) == 1)
else if (sscanf(line, "mount_max = %i", &tmp) == 1) {
if (tmp < -1)
fprintf(stderr,
"%s: invalid mount_max = %i in %s at line %i\n",
progname, tmp, FUSE_CONF, linenum);
else
mount_max = tmp;
}
else if (line[0])
fprintf(stderr,
"%s: unknown parameter in %s at line %i: '%s'\n",