aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Nardi <12729895+IvanNardi@users.noreply.github.com>2021-03-09 19:46:32 +0100
committerGitHub <noreply@github.com>2021-03-09 19:46:32 +0100
commit8074bc82013c9b14cc59a32fcc7c75a6b56ff8dd (patch)
tree96970e134a0c85751f5c7476e35994822afc6f03
parent574fc4f09e2d51e5a797deac6809386d57df6640 (diff)
HTTP: fix memory access in ndpi_http_parse_subprotocol() (#1151)
-rw-r--r--src/lib/protocols/http.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/lib/protocols/http.c b/src/lib/protocols/http.c
index 443fc80f8..9cbd1df5c 100644
--- a/src/lib/protocols/http.c
+++ b/src/lib/protocols/http.c
@@ -352,8 +352,9 @@ static void ndpi_http_parse_subprotocol(struct ndpi_detection_module_struct *ndp
if(ndpi_match_hostname_protocol(ndpi_struct, flow, NDPI_PROTOCOL_HTTP,
(char *)flow->host_server_name,
strlen((const char *)flow->host_server_name)) == 0) {
- if((strstr(flow->http.url, ":8080/downloading?n=0.") != NULL)
- || (strstr(flow->http.url, ":8080/upload?n=0.") != NULL)) {
+ if(flow->http.url &&
+ ((strstr(flow->http.url, ":8080/downloading?n=0.") != NULL)
+ || (strstr(flow->http.url, ":8080/upload?n=0.") != NULL))) {
/* This looks like Ookla speedtest */
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_OOKLA, NDPI_PROTOCOL_HTTP);
}