aboutsummaryrefslogtreecommitdiffstats
path: root/main/nfdump/CVE-2019-14459.patch
blob: 82424ced5f36a85cd68979d37b04faf6c82f9f7d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
diff --git a/bin/ipfix.c b/bin/ipfix.c
index 9029da6..e20303f 100644
--- a/bin/ipfix.c
+++ b/bin/ipfix.c
@@ -1217,6 +1217,13 @@ ipfix_template_record_t *ipfix_template_record;
 	// a template flowset can contain multiple records ( templates )
 	while ( size_left ) {
 		uint32_t id;
+ 
+		if ( size_left < 4 ) {
+			LogError("Process_ipfix [%u] Template withdraw size error at %s line %u" , 
+				exporter->info.id, __FILE__, __LINE__, strerror (errno));
+			size_left = 0;
+			continue;
+		}
 
 		// map next record.
 		ipfix_template_record = (ipfix_template_record_t *)DataPtr;
@@ -1300,7 +1307,7 @@ uint16_t	offset_std_sampler_interval, offset_std_sampler_algorithm, found_std_sa
 		uint16_t id, length;
 		int Enterprise;
 
-		if ( size_left && size_left < 4 ) {
+		if ( size_left < 4 ) {
 			LogError("Process_ipfix [%u] Template size error at %s line %u" , 
 				exporter->info.id, __FILE__, __LINE__, strerror (errno));
 			return;