iputils/iputils-ss021109-sec-ping-setuid-retvalcheck.diff

16 lines
226 B
Diff

--- iputils/ping.c
+++ iputils/ping.c
@@ -125,7 +125,11 @@
socket_errno = errno;
uid = getuid();
- setuid(uid);
+ if(setuid(uid) != 0)
+ {
+ perror("ping: setuid()");
+ exit(-1);
+ }
source.sin_family = AF_INET;