aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lib/protocols/http.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/lib/protocols/http.c b/src/lib/protocols/http.c
index 6951dd85c..271409057 100644
--- a/src/lib/protocols/http.c
+++ b/src/lib/protocols/http.c
@@ -295,10 +295,12 @@ static ndpi_protocol_category_t ndpi_http_check_content(struct ndpi_detection_mo
if(packet->content_disposition_line.ptr[attachment_len] == '\"') {
if(packet->content_disposition_line.ptr[packet->content_disposition_line.len-1] != '\"') {
//case: filename="file_name
- flow->http.filename = ndpi_malloc(filename_len);
- if(flow->http.filename != NULL) {
- strncpy(flow->http.filename, (char*)packet->content_disposition_line.ptr+attachment_len+1, filename_len-1);
- flow->http.filename[filename_len-1] = '\0';
+ if(filename_len >= 2) {
+ flow->http.filename = ndpi_malloc(filename_len);
+ if(flow->http.filename != NULL) {
+ strncpy(flow->http.filename, (char*)packet->content_disposition_line.ptr+attachment_len+1, filename_len-1);
+ flow->http.filename[filename_len-1] = '\0';
+ }
}
}
else if(filename_len >= 2) {