DragonFlyBSD Kernel Audit
DF-0621 / fix.diff
← back to finding ↓ download raw
diff --git a/sys/netinet6/raw_ip6.c b/sys/netinet6/raw_ip6.c
--- a/sys/netinet6/raw_ip6.c
+++ b/sys/netinet6/raw_ip6.c
@@ -294,9 +294,8 @@
 
 	in6p = so->so_pcb;
 
-	priv = 0;
-	if (so->so_cred->cr_uid == 0)
-		priv = 1;
+	priv = (curthread == NULL ||
+	    caps_priv_check_td(curthread, SYSCAP_RESTRICTEDROOT)) ? 0 : 1;
 	dst = &dstsock->sin6_addr;
 	if (control) {
 		if ((error = ip6_setpktoptions(control, &opt,