Added boundary check
This commit is contained in:
@@ -252,7 +252,9 @@ void ndpi_search_kerberos(struct ndpi_detection_module_struct *ndpi_struct,
|
|||||||
realm_offset = cname_len + name_offset + 3;
|
realm_offset = cname_len + name_offset + 3;
|
||||||
|
|
||||||
/* if cname does not end with a $ then it's a username */
|
/* if cname does not end with a $ then it's a username */
|
||||||
if(cname_len && cname_str[cname_len-1] == '$') {
|
if(cname_len
|
||||||
|
&& (cname_len < sizeof(cname_str))
|
||||||
|
&& (cname_str[cname_len-1] == '$')) {
|
||||||
cname_str[cname_len-1] = '\0';
|
cname_str[cname_len-1] = '\0';
|
||||||
snprintf(flow->protos.kerberos.hostname, sizeof(flow->protos.kerberos.hostname), "%s", cname_str);
|
snprintf(flow->protos.kerberos.hostname, sizeof(flow->protos.kerberos.hostname), "%s", cname_str);
|
||||||
} else
|
} else
|
||||||
|
|||||||
Reference in New Issue
Block a user