From: kmhugo Date: Sat, 2 Feb 2002 05:34:17 +0000 (+0000) Subject: Macintosh getlin and BUFSZ X-Git-Tag: MOVE2GIT~3295 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ecc3bc422c317f14b5f20a68ddab58f3eadf26af;p=nethack Macintosh getlin and BUFSZ Ensure getline() returns no more than BUFSZ characters on the Macintosh port. --- diff --git a/sys/mac/macwin.c b/sys/mac/macwin.c index 3e6981127..0cbbdc0a9 100644 --- a/sys/mac/macwin.c +++ b/sys/mac/macwin.c @@ -818,6 +818,10 @@ leave_topl_mode(char *answer) { if (!in_topl_mode()) return; + /* Cap length of reply */ + if (ans_len >= BUFSZ) + ans_len = BUFSZ-1; + /* remove unprintables from the answer */ for (ap = *(*top_line)->hText + topl_query_len, bp = answer; ans_len > 0; ans_len--, ap++) { if (*ap >= ' ' && *ap < 128) {