summaryrefslogtreecommitdiff
blob: db26330d699f16e7c81d17f4a8614cc33c0005bb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
From 15bb7ae4339cc2a4a626a52fcf49abfb1d237d65 Mon Sep 17 00:00:00 2001
From: Alfredo Cardigliano <alfredo.cardigliano@gmail.com>
Date: Wed, 26 Feb 2020 09:55:24 +0100
Subject: [PATCH] Check NULL strings in ndpi_serialize_string_string

---
 src/lib/ndpi_serializer.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/lib/ndpi_serializer.c b/src/lib/ndpi_serializer.c
index 05b346bb..9a3cd0bd 100644
--- a/src/lib/ndpi_serializer.c
+++ b/src/lib/ndpi_serializer.c
@@ -1270,7 +1270,8 @@ int ndpi_serialize_string_binary(ndpi_serializer *_serializer,
 /* Key is a string, value is a string (strlen is used to compute the len) */
 int ndpi_serialize_string_string(ndpi_serializer *_serializer,
 				 const char *key, const char *_value) {
-  return(ndpi_serialize_binary_binary(_serializer, key, strlen(key), _value, strlen(_value)));
+  const char *value = _value ? _value : "";
+  return(ndpi_serialize_binary_binary(_serializer, key, strlen(key), value, strlen(value)));
 }
 
 /* ********************************** */