[fix] terminate the char_array if input token is zero-length in add_normalized_token

This commit is contained in:
Al
2017-04-28 11:25:07 -04:00
parent 04eb2d4539
commit 6ea2273263

View File

@@ -388,7 +388,7 @@ void add_normalized_token(char_array *array, char *str, token_t token, uint64_t
uint8_t *ptr = (uint8_t *)str + token.offset; uint8_t *ptr = (uint8_t *)str + token.offset;
size_t len = token.len; size_t len = token.len;
if (token.len == 0) return; if (token.len > 0) {
bool alpha_numeric_split = false; bool alpha_numeric_split = false;
char *append_if_not_numeric = NULL; char *append_if_not_numeric = NULL;
@@ -477,6 +477,7 @@ void add_normalized_token(char_array *array, char *str, token_t token, uint64_t
last_was_letter = is_letter; last_was_letter = is_letter;
} }
}
char_array_terminate(array); char_array_terminate(array);