Fixed heap-buffer-overflow issue
This commit is contained in:
+9
-1
@@ -3402,7 +3402,15 @@ int ndpi_match_custom_category(struct ndpi_detection_module_struct *ndpi_str,
|
|||||||
if(rc < 0) return rc;
|
if(rc < 0) return rc;
|
||||||
return(id != NDPI_PROTOCOL_UNKNOWN ? 0 : -1);
|
return(id != NDPI_PROTOCOL_UNKNOWN ? 0 : -1);
|
||||||
#else
|
#else
|
||||||
u_int16_t rc = ndpi_domain_classify_contains(ndpi_str->custom_categories.sc_hostnames, name);
|
char buf[128];
|
||||||
|
u_int16_t rc;
|
||||||
|
u_int max_len = sizeof(buf)-1;
|
||||||
|
|
||||||
|
if(name_len > max_len) name_len = max_len;
|
||||||
|
strncpy(buf, name, name_len);
|
||||||
|
buf[name_len] = '\0';
|
||||||
|
|
||||||
|
rc = ndpi_domain_classify_contains(ndpi_str->custom_categories.sc_hostnames, buf);
|
||||||
|
|
||||||
if(rc == 0)
|
if(rc == 0)
|
||||||
return(-1); /* Not found */
|
return(-1); /* Not found */
|
||||||
|
|||||||
Reference in New Issue
Block a user