mirror of git://git.musl-libc.org/musl
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.
This commit is contained in:
parent
ee1d39bc15
commit
f314e13392
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue