projects
/
oweals
/
musl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
a113434
)
fix completely bogus loop condition in getmntent_r
author
Rich Felker
<dalias@aerifal.cx>
Wed, 6 Apr 2011 16:35:05 +0000
(12:35 -0400)
committer
Rich Felker
<dalias@aerifal.cx>
Wed, 6 Apr 2011 16:35:05 +0000
(12:35 -0400)
somehow this worked on my simple fstab, but horribly broke in general,
leading to use of uninitialized offset array and crashes.
src/linux/mntent.c
patch
|
blob
|
history
diff --git
a/src/linux/mntent.c
b/src/linux/mntent.c
index 26d045c24a1067b4a6af56d29e88c58304ea9baf..48c85bd627db62c5307220da97911c03730c2107 100644
(file)
--- a/
src/linux/mntent.c
+++ b/
src/linux/mntent.c
@@
-26,7
+26,7
@@
struct mntent *getmntent_r(FILE *f, struct mntent *mnt, char *linebuf, int bufle
cnt = sscanf(linebuf, " %n%*s%n %n%*s%n %n%*s%n %n%*s%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 (cnt
>= 8 && linebuf[n[0]] !
= '#');
+ } while (cnt
< 2 || linebuf[n[0]] =
= '#');
linebuf[n[1]] = 0;
linebuf[n[3]] = 0;