diff options
author | ache <ache@FreeBSD.org> | 2016-09-08 06:53:18 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 2016-09-08 06:53:18 +0000 |
commit | 03b1daba27fb8c06bc29e353b28b6c313d8f4aa6 (patch) | |
tree | e408ec16facaf005fb06906751e2e1781f5b527f /lib/libc/stdio/fgets.c | |
parent | c029b6df14458c9aeb61ab62bcb24d5fb1102ebf (diff) | |
download | FreeBSD-src-03b1daba27fb8c06bc29e353b28b6c313d8f4aa6.zip FreeBSD-src-03b1daba27fb8c06bc29e353b28b6c313d8f4aa6.tar.gz |
MFC r305406,r305409,r305412
1) Fix errors handling.
2) Prevent out of bounds access to ws[-1] (passed buffer) which happens
when the first mb sequence is incomplete and there are not enougn chars in
the read buffer. ws[-1] may lead to memory faults or false results, in
case the memory here contains '\n'.
3) Fix n == 1 case. Here should be no physical read (fill buffer) attempt
(we read n - 1 chars with the room for NUL, see fgets()),
and no NULL return.
Diffstat (limited to 'lib/libc/stdio/fgets.c')
0 files changed, 0 insertions, 0 deletions