Macintosh getlin and BUFSZ
Ensure getline() returns no more than BUFSZ characters on the Macintosh port.
This commit is contained in:
@@ -818,6 +818,10 @@ leave_topl_mode(char *answer) {
|
|||||||
if (!in_topl_mode())
|
if (!in_topl_mode())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
/* Cap length of reply */
|
||||||
|
if (ans_len >= BUFSZ)
|
||||||
|
ans_len = BUFSZ-1;
|
||||||
|
|
||||||
/* remove unprintables from the answer */
|
/* remove unprintables from the answer */
|
||||||
for (ap = *(*top_line)->hText + topl_query_len, bp = answer; ans_len > 0; ans_len--, ap++) {
|
for (ap = *(*top_line)->hText + topl_query_len, bp = answer; ans_len > 0; ans_len--, ap++) {
|
||||||
if (*ap >= ' ' && *ap < 128) {
|
if (*ap >= ' ' && *ap < 128) {
|
||||||
|
|||||||
Reference in New Issue
Block a user