mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-02 12:20:51 +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 New Issue
Block a user