Fixes crash when searching kerberos usernames
Fixes
(gdb) f 0
101 if(cname_str[cname_len-1] == '$') {
(gdb) p cname_len
$3 = 0
This commit is contained in:
@@ -98,7 +98,7 @@ void ndpi_search_kerberos(struct ndpi_detection_module_struct *ndpi_struct,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* 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_str[cname_len-1] == '$') {
|
if(cname_len && 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
|
||||||
@@ -184,7 +184,7 @@ void ndpi_search_kerberos(struct ndpi_detection_module_struct *ndpi_struct,
|
|||||||
printf("[Kerberos Cname][len: %u][%s]\n", cname_len, cname_str);
|
printf("[Kerberos Cname][len: %u][%s]\n", cname_len, cname_str);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(cname_str[cname_len-1] == '$') {
|
if(cname_len && 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