mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-15 12:54:27 +00:00
Fix an off-by-one buffer overflow in ngets().
Submitted by: Bruce Can MFC after: 1 month
This commit is contained in:
parent
fa01cfefc2
commit
b0d8ed7ad3
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=190593
|
@ -74,7 +74,7 @@ ngets(char *buf, int n)
|
|||
putchar('\n');
|
||||
break;
|
||||
default:
|
||||
if ((n < 1) || ((lp - buf) < n)) {
|
||||
if ((n < 1) || ((lp - buf) < n - 1)) {
|
||||
*lp++ = c;
|
||||
putchar(c);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue