summaryrefslogtreecommitdiffstats
path: root/usr.sbin/traceroute
diff options
context:
space:
mode:
authorkn <kn@openbsd.org>2018-10-20 19:55:01 +0000
committerkn <kn@openbsd.org>2018-10-20 19:55:01 +0000
commit8a24d67a42f304bc6e9c13e01c33c68f8ae0764e (patch)
treeaf757e9380aabd3c4dc0a34b30e15e0c7ac1e64c /usr.sbin/traceroute
parentAvoid calling memcpy with a length <= 0. Reported due to a GCC 7.3.0 (diff)
downloadwireguard-openbsd-8a24d67a42f304bc6e9c13e01c33c68f8ae0764e.tar.xz
wireguard-openbsd-8a24d67a42f304bc6e9c13e01c33c68f8ae0764e.zip
Sync root check from ping
Sync ping.c r1.217 (20.10.2016) to only drop uid/gid if invoked as root. OK sthen
Diffstat (limited to 'usr.sbin/traceroute')
-rw-r--r--usr.sbin/traceroute/traceroute.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.sbin/traceroute/traceroute.c b/usr.sbin/traceroute/traceroute.c
index 9c8a1ce8e6a..cd02cd9afa0 100644
--- a/usr.sbin/traceroute/traceroute.c
+++ b/usr.sbin/traceroute/traceroute.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: traceroute.c,v 1.156 2018/10/15 11:31:11 florian Exp $ */
+/* $OpenBSD: traceroute.c,v 1.157 2018/10/20 19:55:01 kn Exp $ */
/* $NetBSD: traceroute.c,v 1.10 1995/05/21 15:50:45 mycroft Exp $ */
/*
@@ -359,7 +359,7 @@ main(int argc, char *argv[])
/* revoke privs */
ouid = getuid();
- if ((pw = getpwnam(TRACEROUTE_USER)) != NULL) {
+ if (ouid == 0 && (pw = getpwnam(TRACEROUTE_USER)) != NULL) {
uid = pw->pw_uid;
gid = pw->pw_gid;
} else {