Fixed error message reporting for the case when regex exhaust tested string

This commit is contained in:
Sergey Lyubka 2013-09-28 02:11:33 +01:00
parent e5d1a3901a
commit acd861b945

2
slre.c
View File

@ -275,7 +275,7 @@ static int bar(const char *re, int re_len, const char *s, int s_len,
} else if (re[i] == '$') { } else if (re[i] == '$') {
FAIL_IF(j != s_len, static_error_no_match); FAIL_IF(j != s_len, static_error_no_match);
} else { } else {
FAIL_IF(j == s_len, info->error_msg); FAIL_IF(j >= s_len, static_error_no_match);
n = match_op((unsigned char *) (re + i), (unsigned char *) (s + j), info); n = match_op((unsigned char *) (re + i), (unsigned char *) (s + j), info);
FAIL_IF(n <= 0, info->error_msg); FAIL_IF(n <= 0, info->error_msg);
j += n; j += n;