summaryrefslogtreecommitdiffstats
path: root/sbin/ping6
diff options
context:
space:
mode:
authoreadler <eadler@FreeBSD.org>2012-10-22 03:31:22 +0000
committereadler <eadler@FreeBSD.org>2012-10-22 03:31:22 +0000
commit4bc19b04c5658de751c40ddf1399ab0dd1d895e7 (patch)
tree3aa86a2f61ac3b57647e44878110dc60da9069e7 /sbin/ping6
parentf4d42efdb90dc9f022d3764a5d1ddcfe4a846713 (diff)
downloadFreeBSD-src-4bc19b04c5658de751c40ddf1399ab0dd1d895e7.zip
FreeBSD-src-4bc19b04c5658de751c40ddf1399ab0dd1d895e7.tar.gz
Check the return error of set[ug]id. While this can never fail in the
current version of FreeBSD, this isn't guarenteed by the API. Custom security modules, or future implementations of the setuid and setgid may fail. PR: bin/172289 PR: bin/172290 PR: bin/172291 Submittud by: Erik Cederstrand <erik@cederstrand.dk> Discussed by: freebsd-security Approved by: cperciva MFC after: 1 week
Diffstat (limited to 'sbin/ping6')
-rw-r--r--sbin/ping6/ping6.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sbin/ping6/ping6.c b/sbin/ping6/ping6.c
index 711561e..8c3e16b 100644
--- a/sbin/ping6/ping6.c
+++ b/sbin/ping6/ping6.c
@@ -702,8 +702,10 @@ main(int argc, char *argv[])
}
/* revoke root privilege */
- seteuid(getuid());
- setuid(getuid());
+ if (seteuid(getuid()) != 0)
+ err(1, "seteuid() failed");
+ if (setuid(getuid()) != 0)
+ err(1, "setuid() failed");
if ((options & F_FLOOD) && (options & F_INTERVAL))
errx(1, "-f and -i incompatible options");
OpenPOWER on IntegriCloud