don't copy over the garbage from the source buffer (like, leaking
the canary). OK millert@.
-/* $OpenBSD: rwho.c,v 1.18 2013/11/27 13:32:02 okan Exp $ */
+/* $OpenBSD: rwho.c,v 1.19 2014/01/09 05:07:37 martynas Exp $ */
/*
* Copyright (c) 1983 The Regents of the University of California.
}
if (nusers >= NUSERS)
errx(1, "too many users");
- memcpy(mp->myhost, w->wd_hostname,
+ strncpy(mp->myhost, w->wd_hostname,
sizeof(mp->myhost)-1);
mp->myhost[sizeof(mp->myhost)-1] = '\0';
mp->myidle = we->we_idle;