Handle too long strings correctly in print_autowrap()

Submitted by: Marc van Kempen <wmbdmr@urc.tue.nl>
This commit is contained in:
Andrey A. Chernov 1995-04-30 19:43:53 +00:00
parent 7439966a40
commit 1ccc95ada5

View File

@ -174,7 +174,8 @@ void print_autowrap(WINDOW *win, unsigned char *prompt, int height, int width, i
wsetscrreg(win, y, height);
getyx(win, cur_y, cur_x);
strcpy(tempstr, prompt);
strncpy(tempstr, prompt, MAX_LEN);
tempstr[MAX_LEN] = '\0';
if ((!rawmode && strstr(tempstr, "\\n") != NULL) ||
(strchr(tempstr, '\n') != NULL)) { /* Prompt contains "\n" or '\n' */
word = tempstr;