summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVáclav Doležal <vdolezal@redhat.com>2018-11-07 16:10:33 +0100
committerAmadeusz Sławiński <amade@asmblr.net>2018-11-18 16:01:00 +0100
commit26e61437ef70d728f6030f3b12da2493753044e7 (patch)
tree07d82d046a7079ad5e2fb7c1495d9a32f078e054
parent61d6955517173040b0bc096a9284493e0ad31a1b (diff)
downloadscreen-26e61437ef70d728f6030f3b12da2493753044e7.tar.gz
Fix possible unterminated string
Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com> Signed-off-by: Amadeusz Sławiński <amade@asmblr.net
-rw-r--r--src/pty.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/pty.c b/src/pty.c
index 1c0660e..eba3bb0 100644
--- a/src/pty.c
+++ b/src/pty.c
@@ -279,7 +279,13 @@ char **ttyn;
return -1;
}
signal(SIGCHLD, sigcld);
- strncpy(TtyName, m, sizeof(TtyName));
+ if (strlen(m) < sizeof(TtyName))
+ strcpy(TtyName, m);
+ else
+ {
+ close(f);
+ return -1;
+ }
initmaster(f);
*ttyn = TtyName;
return f;