From 398ad8e5ffc69640d5a41ef73d0c2f146bc94f06 Mon Sep 17 00:00:00 2001 From: Vitaly Lavrov Date: Wed, 7 Jul 2021 12:32:57 +0000 Subject: Fix for #1230 (#1235) * Revert "Fix return value of ndpi_match_string_subprotocol() (#1230)" This reverts commit 58665e93a98d014b53d131b2481ccab074efc9ff. * Checking the return code after calling ndpi_match_string_subprotocol() ndpi_api.h: Description of the returned error codes for the ndpi_match_string_subprotocol() function. If the ndpi_match_string_subprotocol() function returned an error, then return NDPI_PROTOCOL_UNKNOWN. http: The "Content-type" header is only checked if it is not empty. --- src/lib/protocols/http.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/lib/protocols') diff --git a/src/lib/protocols/http.c b/src/lib/protocols/http.c index 6a3df8e26..79110a531 100644 --- a/src/lib/protocols/http.c +++ b/src/lib/protocols/http.c @@ -656,7 +656,7 @@ static void check_content_type_and_change_protocol(struct ndpi_detection_module_ } } - if(flow->http_detected) { + if(flow->http_detected && packet->content_line.ptr && *(char*)packet->content_line.ptr) { ndpi_protocol_match_result ret_match; ndpi_match_content_subprotocol(ndpi_struct, flow, -- cgit v1.2.3