summaryrefslogtreecommitdiffstats
path: root/gnu
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>1995-04-30 19:43:53 +0000
committerache <ache@FreeBSD.org>1995-04-30 19:43:53 +0000
commit98983f573b28e96799662ad8c01789ef1ef7c9e7 (patch)
tree8bea874206e3d5ebddf43f66ee59c688bfb4a03f /gnu
parent87e4e8e6d540cf496e4a9dbb98d62b5f532bc670 (diff)
downloadFreeBSD-src-98983f573b28e96799662ad8c01789ef1ef7c9e7.zip
FreeBSD-src-98983f573b28e96799662ad8c01789ef1ef7c9e7.tar.gz
Handle too long strings correctly in print_autowrap()
Submitted by: Marc van Kempen <wmbdmr@urc.tue.nl>
Diffstat (limited to 'gnu')
-rw-r--r--gnu/lib/libdialog/kernel.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/gnu/lib/libdialog/kernel.c b/gnu/lib/libdialog/kernel.c
index defb321..08652fe 100644
--- a/gnu/lib/libdialog/kernel.c
+++ b/gnu/lib/libdialog/kernel.c
@@ -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;
OpenPOWER on IntegriCloud