Fixed invalid ndpi_match_string_id() return code

This commit is contained in:
Luca Deri
2017-05-01 23:05:42 +02:00
parent 3f5e4cb7ee
commit 442adce51d
+3 -3
View File
@@ -1913,17 +1913,17 @@ int ndpi_match_string_id(void *_automa, char *string_to_match, unsigned long *id
AC_TEXT_t ac_input_text;
AC_AUTOMATA_t *automa = (AC_AUTOMATA_t*)_automa;
*id = 0;
*id = -1;
if((automa == NULL)
|| (string_to_match == NULL)
|| (string_to_match[0] == '\0'))
return(-2);
ac_input_text.astring = string_to_match, ac_input_text.length = strlen(string_to_match);
ac_automata_search(automa, &ac_input_text, (void*)&id);
ac_automata_search(automa, &ac_input_text, (void*)id);
ac_automata_reset(automa);
return(*id > 0 ? *id : -1);
return(*id != -1 ? 0 : -1);
}
/* *********************************************** */