aboutsummaryrefslogtreecommitdiffstats
path: root/main/nfdump/CVE-2019-14459.patch
blob: 6e10f0dcbe17015276a1b11ba95b5bdd8762999c (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 f998b72..604fe25 100644
--- a/bin/ipfix.c
+++ b/bin/ipfix.c
@@ -1067,6 +1067,13 @@ ipfix_template_record_t *ipfix_template_record;
 	while ( size_left ) {
 		uint32_t id, count;
 
+		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;
 		size_left 		-= 4;
@@ -1146,7 +1153,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;