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
@ -74,7 +74,7 @@ ngets(char *buf, int n)
|
|||||||
putchar('\n');
|
putchar('\n');
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if ((n < 1) || ((lp - buf) < n)) {
|
if ((n < 1) || ((lp - buf) < n - 1)) {
|
||||||
*lp++ = c;
|
*lp++ = c;
|
||||||
putchar(c);
|
putchar(c);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user