diff --git a/src/lib/protocols/http.c b/src/lib/protocols/http.c index 926b7f0321d..072f7d3de68 100644 --- a/src/lib/protocols/http.c +++ b/src/lib/protocols/http.c @@ -300,7 +300,7 @@ static ndpi_protocol_category_t ndpi_http_check_content(struct ndpi_detection_mo flow->http.filename[filename_len-1] = '\0'; } } - else{ + else if(filename_len >= 2) { //case: filename="file_name" flow->http.filename = ndpi_malloc(filename_len-1); @@ -310,8 +310,7 @@ static ndpi_protocol_category_t ndpi_http_check_content(struct ndpi_detection_mo flow->http.filename[filename_len-2] = '\0'; } } - } - else{ + } else { //case: filename=file_name flow->http.filename = ndpi_malloc(filename_len+1);