From f314e133929b6379eccc632bef32eaebb66a7335 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Thu, 16 Nov 2023 12:55:21 -0500 Subject: mntent: fields are delimited only by tabs or spaces, not general whitespace this matters because the kernel-provided mtab only escapes tabs, spaces, newlines, and backslashes. it leaves carriage returns, form feeds, and vertical tabs literal. --- src/misc/mntent.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/misc') diff --git a/src/misc/mntent.c b/src/misc/mntent.c index e9393883..78bf0cd0 100644 --- a/src/misc/mntent.c +++ b/src/misc/mntent.c @@ -81,7 +81,7 @@ struct mntent *getmntent_r(FILE *f, struct mntent *mnt, char *linebuf, int bufle len = strlen(linebuf); if (len > INT_MAX) continue; for (i = 0; i < sizeof n / sizeof *n; i++) n[i] = len; - sscanf(linebuf, " %n%*s%n %n%*s%n %n%*s%n %n%*s%n %d %d", + sscanf(linebuf, " %n%*[^ \t]%n %n%*[^ \t]%n %n%*[^ \t]%n %n%*[^ \t]%n %d %d", n, n+1, n+2, n+3, n+4, n+5, n+6, n+7, &mnt->mnt_freq, &mnt->mnt_passno); } while (linebuf[n[0]] == '#' || n[1]==len); -- cgit v1.2.1