projects
/
musl
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
prevent CNAME/PTR parsing from reading data past the response end
[musl]
/
src
/
stdio
/
fgets.c
diff --git
a/src/stdio/fgets.c
b/src/stdio/fgets.c
index
6171f39
..
4a100b3
100644
(file)
--- a/
src/stdio/fgets.c
+++ b/
src/stdio/fgets.c
@@
-12,13
+12,14
@@
char *fgets(char *restrict s, int n, FILE *restrict f)
FLOCK(f);
- if (n
--
<=1) {
+ if (n<=1) {
f->mode |= f->mode-1;
FUNLOCK(f);
- if (n) return 0;
+ if (n
<1
) return 0;
*s = 0;
return s;
}
+ n--;
while (n) {
if (f->rpos != f->rend) {