summaryrefslogtreecommitdiffstats
path: root/network/hping3/patches/data_size_udp.diff
blob: b10c243eb800dbab4cbf0f4afcbcdca39ba8af1e (plain)

Fix incorrect data size check for UDP.

--- a/parseoptions.c
+++ b/parseoptions.c
@@ -569,9 +573,12 @@
 	if (opt_numeric == TRUE) opt_gethost = FALSE;
 
 	/* some error condition */
-	if (data_size+IPHDR_SIZE+TCPHDR_SIZE > 65535) {
+	if (data_size+IPHDR_SIZE+
+	    (opt_udpmode?UDPHDR_SIZE:TCPHDR_SIZE) > 65535) {
 		printf("Option error: sorry, data size must be <= %lu\n",
-			(unsigned long)(65535-IPHDR_SIZE+TCPHDR_SIZE));
+			(unsigned long)(65535-(IPHDR_SIZE+
+					(opt_udpmode?UDPHDR_SIZE:TCPHDR_SIZE)))
+				       );
 		exit(1);
 	}
 	else if (count <= 0 && count != -1) {