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

17 lines
341 B
Diff

--- iputils/traceroute6.c
+++ iputils/traceroute6.c
@@ -337,8 +337,11 @@
icmp_sock = socket(AF_INET6, SOCK_RAW, IPPROTO_ICMPV6);
socket_errno = errno;
- setuid(getuid());
-
+ if(setuid(getuid()) != 0)
+ {
+ Fprintf(stderr, "traceroute: setuid()\n");
+ exit(-1);
+ }
on = 1;
seq = tos = 0;
to = (struct sockaddr_in6 *)&whereto;