aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLuca Deri <deri@ntop.org>2017-05-01 23:05:42 +0200
committerLuca Deri <deri@ntop.org>2017-05-01 23:05:42 +0200
commit442adce51db0b3fd9fdfe9f80df9e3cb767414c1 (patch)
tree63b61f36c0e624d6f886c941be6b6f8580d5c54a /src
parent3f5e4cb7ee74c9a92d48029125121ea58b816cb6 (diff)
Fixed invalid ndpi_match_string_id() return code
Diffstat (limited to 'src')
-rw-r--r--src/lib/ndpi_main.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lib/ndpi_main.c b/src/lib/ndpi_main.c
index b318ce566..1ef83dcc7 100644
--- a/src/lib/ndpi_main.c
+++ b/src/lib/ndpi_main.c
@@ -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);
}
/* *********************************************** */