Try to fix reading freed memory in eval.c.
This occurred when the null term was reached - the token was freed, but no error was thrown (it's just the end of the string), so the program attempted to increment the index using freed token data.
This commit is contained in:
@@ -209,7 +209,7 @@ liblex_result eval_all(char* string, int index, eval_config* config, ll* matches
|
||||
result = ll_append(matches, new_match) == LIBDS_SUCCESS ? LIBLEX_SUCCESS : LIBLEX_MALLOC;
|
||||
}
|
||||
}
|
||||
if(result == LIBLEX_SUCCESS){
|
||||
if(result == LIBLEX_SUCCESS && string[index] != '\0'){
|
||||
index += new_match->to - new_match->from;
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user