From 72992afb264bb7601e98e34f02fc524145081fe7 Mon Sep 17 00:00:00 2001 From: Kevin Steves Date: Tue, 14 Aug 2001 20:54:52 +0000 Subject: [PATCH] - (stevesk) bsd-cray.c: utmp strings are not C strings --- ChangeLog | 3 ++- openbsd-compat/bsd-cray.c | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7e5a776fd..76f167feb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,7 @@ for some #ifdef _CRAY code; ok wendyp@cray.com - (stevesk) sshpty.c: return 0 on error in cray pty code; ok wendyp@cray.com + - (stevesk) bsd-cray.c: utmp strings are not C strings 20010812 - (djm) Fix detection of long long int support. Based on patch from @@ -6284,4 +6285,4 @@ - Wrote replacements for strlcpy and mkdtemp - Released 1.0pre1 -$Id: ChangeLog,v 1.1472 2001/08/14 20:41:34 stevesk Exp $ +$Id: ChangeLog,v 1.1473 2001/08/14 20:54:52 stevesk Exp $ diff --git a/openbsd-compat/bsd-cray.c b/openbsd-compat/bsd-cray.c index 3cef7d15d..a03344f72 100644 --- a/openbsd-compat/bsd-cray.c +++ b/openbsd-compat/bsd-cray.c @@ -164,9 +164,10 @@ cray_retain_utmp(struct utmp *ut, int pid) while (read(fd, (char *)&utmp, sizeof(utmp)) == sizeof(utmp)) { if (pid == utmp.ut_pid) { ut->ut_jid = utmp.ut_jid; - strncpy(ut->ut_tpath, utmp.ut_tpath, TPATHSIZ); - strncpy(ut->ut_host, utmp.ut_host, strlen(utmp.ut_host)); - strncpy(ut->ut_name, utmp.ut_name, strlen(utmp.ut_name)); + /* XXX: MIN_SIZEOF here? can this go in loginrec? */ + strncpy(ut->ut_tpath, utmp.ut_tpath, sizeof(utmp.ut_tpath)); + strncpy(ut->ut_host, utmp.ut_host, sizeof(utmp.ut_host)); + strncpy(ut->ut_name, utmp.ut_name, sizeof(utmp.ut_name)); break; } }