aboutsummaryrefslogtreecommitdiff
path: root/net/hping3/patches/140_data_size_udp.patch
blob: 6f07b0ded5cd92da664df4ced7e4af0ad3d6fa26 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
Subject: Fix incorrect data size check for UDP.
Author: Luca Bigliardi <shammash@artha.org>
Bug-Debian; http://bugs.debian.org/546590
Last-Update: 2009-09-19

--- a/parseoptions.c
+++ b/parseoptions.c
@@ -606,9 +606,12 @@ int parse_options(int argc, char **argv)
 	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) {