Minor code cleanup
This commit is contained in:
@@ -296,15 +296,17 @@ static ndpi_protocol_category_t ndpi_http_check_content(struct ndpi_detection_mo
|
|||||||
//case: filename="file_name
|
//case: filename="file_name
|
||||||
flow->http.filename = ndpi_malloc(filename_len);
|
flow->http.filename = ndpi_malloc(filename_len);
|
||||||
if(flow->http.filename != NULL) {
|
if(flow->http.filename != NULL) {
|
||||||
flow->http.filename = strncpy(flow->http.filename, (char*)packet->content_disposition_line.ptr+attachment_len+1, filename_len-1);
|
strncpy(flow->http.filename, (char*)packet->content_disposition_line.ptr+attachment_len+1, filename_len-1);
|
||||||
flow->http.filename[filename_len-1] = '\0';
|
flow->http.filename[filename_len-1] = '\0';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
//case: filename="file_name"
|
//case: filename="file_name"
|
||||||
flow->http.filename = ndpi_malloc(filename_len-1);
|
flow->http.filename = ndpi_malloc(filename_len-1);
|
||||||
|
|
||||||
if(flow->http.filename != NULL) {
|
if(flow->http.filename != NULL) {
|
||||||
flow->http.filename = strncpy(flow->http.filename, (char*)packet->content_disposition_line.ptr+attachment_len+1, filename_len-2);
|
strncpy(flow->http.filename, (char*)packet->content_disposition_line.ptr+attachment_len+1,
|
||||||
|
filename_len-2);
|
||||||
flow->http.filename[filename_len-2] = '\0';
|
flow->http.filename[filename_len-2] = '\0';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -312,8 +314,9 @@ static ndpi_protocol_category_t ndpi_http_check_content(struct ndpi_detection_mo
|
|||||||
else{
|
else{
|
||||||
//case: filename=file_name
|
//case: filename=file_name
|
||||||
flow->http.filename = ndpi_malloc(filename_len+1);
|
flow->http.filename = ndpi_malloc(filename_len+1);
|
||||||
|
|
||||||
if(flow->http.filename != NULL) {
|
if(flow->http.filename != NULL) {
|
||||||
flow->http.filename = strncpy(flow->http.filename, (char*)packet->content_disposition_line.ptr+attachment_len, filename_len);
|
strncpy(flow->http.filename, (char*)packet->content_disposition_line.ptr+attachment_len, filename_len);
|
||||||
flow->http.filename[filename_len] = '\0';
|
flow->http.filename[filename_len] = '\0';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user