diff options
author | Luca Deri <lucaderi@users.noreply.github.com> | 2020-02-26 08:06:11 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-26 08:06:11 +0100 |
commit | c0ec78885d39b6211b5a0a1858236e9c875e521d (patch) | |
tree | 80ebcef5009d5e3b9989ff4b20938decdff8bb54 /src | |
parent | a55c410202169d54857c9a736fe365e4ad5657a7 (diff) | |
parent | e675be1a8318d9906a0e6d23baa06d7ff20a389e (diff) |
Merge pull request #849 from annp1987/fix_ndpi_flow2json_segfault
ndpi_flow2json should check http.url before serializer
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/ndpi_utils.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/lib/ndpi_utils.c b/src/lib/ndpi_utils.c index 1f57da19f..b3e92fdce 100644 --- a/src/lib/ndpi_utils.c +++ b/src/lib/ndpi_utils.c @@ -1032,10 +1032,12 @@ int ndpi_flow2json(struct ndpi_detection_module_struct *ndpi_struct, ndpi_serialize_start_of_block(serializer, "http"); if(flow->host_server_name[0] != '\0') ndpi_serialize_string_string(serializer, "hostname", (const char*)flow->host_server_name); - ndpi_serialize_string_string(serializer, "url", flow->http.url); - ndpi_serialize_string_uint32(serializer, "code", flow->http.response_status_code); - ndpi_serialize_string_string(serializer, "content_type", flow->http.content_type); - ndpi_serialize_string_string(serializer, "user_agent", flow->http.user_agent); + if(flow->http.url != NULL){ + ndpi_serialize_string_string(serializer, "url", flow->http.url); + ndpi_serialize_string_uint32(serializer, "code", flow->http.response_status_code); + ndpi_serialize_string_string(serializer, "content_type", flow->http.content_type); + ndpi_serialize_string_string(serializer, "user_agent", flow->http.user_agent); + } ndpi_serialize_end_of_block(serializer); break; |