diff options
author | delphij <delphij@FreeBSD.org> | 2014-12-10 08:24:02 +0000 |
---|---|---|
committer | delphij <delphij@FreeBSD.org> | 2014-12-10 08:24:02 +0000 |
commit | 25ca306958f47d2bcf719496b52d5b1d9d9571c2 (patch) | |
tree | caa79db0b945f59dd3856d9368db5b3d72841769 /lib | |
parent | 88952b61c5d1e863d6ffa6ff669fbc8cec712efe (diff) | |
download | FreeBSD-src-25ca306958f47d2bcf719496b52d5b1d9d9571c2.zip FreeBSD-src-25ca306958f47d2bcf719496b52d5b1d9d9571c2.tar.gz |
MFC r275665:
Fix buffer overflow in stdio.
Security: FreeBSD-SA-14:27.stdio
Security: CVE-2014-8611
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/stdio/fflush.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/libc/stdio/fflush.c b/lib/libc/stdio/fflush.c index ef9b45b..123167a 100644 --- a/lib/libc/stdio/fflush.c +++ b/lib/libc/stdio/fflush.c @@ -124,11 +124,13 @@ __sflush(FILE *fp) t = _swrite(fp, (char *)p, n); if (t <= 0) { /* Reset _p and _w. */ - if (p > fp->_p) /* Some was written. */ + if (p > fp->_p) { + /* Some was written. */ memmove(fp->_p, p, n); - fp->_p += n; - if ((fp->_flags & (__SLBF | __SNBF)) == 0) - fp->_w -= n; + fp->_p += n; + if ((fp->_flags & (__SLBF | __SNBF)) == 0) + fp->_w -= n; + } fp->_flags |= __SERR; return (EOF); } |