diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2001-08-18 21:38:56 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2001-08-18 21:38:56 +0000 |
commit | 67d913d1e873062b4cda64b5ffec65355b4d4f97 (patch) | |
tree | d768c76c6f840567054c15eb2179b2ecab403f29 /libexec | |
parent | bbfb9c24550abb2ff59443a1cdcd2e66de9ff762 (diff) |
i think this pads the buffers correctly
Diffstat (limited to 'libexec')
-rw-r--r-- | libexec/rpc.rusersd/rusers_proc.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/libexec/rpc.rusersd/rusers_proc.c b/libexec/rpc.rusersd/rusers_proc.c index d272488836a..1e5665fae0b 100644 --- a/libexec/rpc.rusersd/rusers_proc.c +++ b/libexec/rpc.rusersd/rusers_proc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rusers_proc.c,v 1.10 2001/08/18 18:31:21 deraadt Exp $ */ +/* $OpenBSD: rusers_proc.c,v 1.11 2001/08/18 21:38:55 deraadt Exp $ */ /*- * Copyright (c) 1993 John Brezak @@ -29,7 +29,7 @@ */ #ifndef lint -static char rcsid[] = "$OpenBSD: rusers_proc.c,v 1.10 2001/08/18 18:31:21 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: rusers_proc.c,v 1.11 2001/08/18 21:38:55 deraadt Exp $"; #endif /* not lint */ #include <sys/param.h> @@ -75,9 +75,9 @@ static char rcsid[] = "$OpenBSD: rusers_proc.c,v 1.10 2001/08/18 18:31:21 deraad #define UT_HOSTSIZE sizeof(((struct utmp *)0)->ut_host) #endif -typedef char ut_line_t[UT_LINESIZE]; -typedef char ut_name_t[UT_NAMESIZE]; -typedef char ut_host_t[UT_HOSTSIZE]; +typedef char ut_line_t[UT_LINESIZE+1]; +typedef char ut_name_t[UT_NAMESIZE+1]; +typedef char ut_host_t[UT_HOSTSIZE+1]; struct rusers_utmp utmps[MAXUSERS]; struct utmpidle *utmp_idlep[MAXUSERS]; @@ -251,10 +251,13 @@ do_names_3(int all) utmps[nusers].ut_idle = getidle(usr.ut_line, usr.ut_host); utmps[nusers].ut_line = line[nusers]; + memset(line[nusers], 0, sizeof(line[nusers])); strlcpy(line[nusers], usr.ut_line, sizeof(line[nusers])); utmps[nusers].ut_user = name[nusers]; + memset(name[nusers], 0, sizeof(name[nusers])); strlcpy(name[nusers], usr.ut_name, sizeof(name[nusers])); utmps[nusers].ut_host = host[nusers]; + memset(host[nusers], 0, sizeof(host[nusers])); strlcpy(host[nusers], usr.ut_host, sizeof(host[nusers])); nusers++; } @@ -313,10 +316,13 @@ do_names_2(int all) utmp_idle[nusers].ui_idle = getidle(usr.ut_line, usr.ut_host); utmp_idle[nusers].ui_utmp.ut_line = line[nusers]; + memset(line[nusers], 0, sizeof(line[nusers])); strlcpy(line[nusers], usr.ut_line, sizeof(line[nusers])); utmp_idle[nusers].ui_utmp.ut_name = name[nusers]; + memset(name[nusers], 0, sizeof(name[nusers])); strlcpy(name[nusers], usr.ut_name, sizeof(name[nusers])); utmp_idle[nusers].ui_utmp.ut_host = host[nusers]; + memset(host[nusers], 0, sizeof(host[nusers])); strlcpy(host[nusers], usr.ut_host, sizeof(host[nusers])); nusers++; } |