Fix an off-by-one buffer overflow in ngets().
Submitted by: Bruce Can MFC after: 1 month
This commit is contained in:
parent
4e28805a1b
commit
6368eeb9b5
@ -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