summaryrefslogtreecommitdiff
path: root/libexec/telnetd/sys_term.c
diff options
context:
space:
mode:
authorChad Loder <cloder@cvs.openbsd.org>2002-11-22 02:37:48 +0000
committerChad Loder <cloder@cvs.openbsd.org>2002-11-22 02:37:48 +0000
commit899c915f9eb1bc67538625befc06274ec1b98d7f (patch)
tree554c32e3115dead075616c4acd1326da85aa6347 /libexec/telnetd/sys_term.c
parent93020230a72487254152845a37e3a84f87c4ca03 (diff)
Correct string termination in jobend() for saved_path and saved_user.
OK millert@
Diffstat (limited to 'libexec/telnetd/sys_term.c')
-rw-r--r--libexec/telnetd/sys_term.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/libexec/telnetd/sys_term.c b/libexec/telnetd/sys_term.c
index 88fdd56e004..d253f373d7c 100644
--- a/libexec/telnetd/sys_term.c
+++ b/libexec/telnetd/sys_term.c
@@ -1812,6 +1812,11 @@ cleantmp(wtp)
return(ret);
}
+/*
+ * jobend
+ * Assumes that if path is not NULL, then user is also
+ * not NULL.
+ */
int
jobend(jid, path, user)
int jid;
@@ -1841,10 +1846,10 @@ jobend(jid, path, user)
}
if (path) {
- strncpy(saved_path, path, sizeof(wtmp.ut_tpath));
- strncpy(saved_user, user, sizeof(wtmp.ut_user));
- saved_path[sizeof(saved_path)] = '\0';
- saved_user[sizeof(saved_user)] = '\0';
+ strncpy(saved_path, path, sizeof(saved_path) - 1);
+ strncpy(saved_user, path, sizeof(saved_user) - 1);
+ saved_path[sizeof(saved_path) - 1] = '\0';
+ saved_user[sizeof(saved_user) - 1] = '\0';
}
if (saved_jid == 0) {
saved_jid = jid;