summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormartynas <martynas@openbsd.org>2014-01-09 05:07:37 +0000
committermartynas <martynas@openbsd.org>2014-01-09 05:07:37 +0000
commit4e6ebd2a2c98161c2e497c0c110a9c484ce6e4d0 (patch)
treea7cb30ad8b45d25867283556eb0ffc17580e6f71
parentUse destination bound rather than the source bound for out_line and (diff)
downloadwireguard-openbsd-4e6ebd2a2c98161c2e497c0c110a9c484ce6e4d0.tar.xz
wireguard-openbsd-4e6ebd2a2c98161c2e497c0c110a9c484ce6e4d0.zip
Switch to string copy rather than memcpy so we stop past '\0' and
don't copy over the garbage from the source buffer (like, leaking the canary). OK millert@.
-rw-r--r--usr.bin/rwho/rwho.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.bin/rwho/rwho.c b/usr.bin/rwho/rwho.c
index f82ab5b59f9..598236cfb32 100644
--- a/usr.bin/rwho/rwho.c
+++ b/usr.bin/rwho/rwho.c
@@ -1,4 +1,4 @@
-/* $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.
@@ -124,7 +124,7 @@ main(int argc, char **argv)
}
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;