DragonFlyBSD Kernel Audit
DF-0334 / fix.diff
← back to finding ↓ download raw
diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c
--- a/sys/netinet/in_pcb.c
+++ b/sys/netinet/in_pcb.c
@@ -882,6 +882,8 @@
 	KKASSERT(last >= first);
 
 	count = last - first;
+	if (count == 0)
+		return (EADDRNOTAVAIL);
 	lport = (karc4random() % count) + first;
 	count += hash_count;