(mc_search__g_regex_match_full_safe): don't use negative string length.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2016-12-06 15:07:15 +03:00
parent 2e078ff774
commit 37de8e6253

View File

@ -277,6 +277,9 @@ mc_search__g_regex_match_full_safe (const GRegex * regex,
char *string_safe, *p, *end;
gboolean ret;
if (string_len < 0)
string_len = strlen (string);
if ((g_regex_get_compile_flags (regex) & G_REGEX_RAW)
|| g_utf8_validate (string, string_len, NULL))
{
@ -284,11 +287,6 @@ mc_search__g_regex_match_full_safe (const GRegex * regex,
match_info, error);
}
if (string_len < 0)
{
string_len = strlen (string);
}
/* Correctly handle embedded NULs while copying */
p = string_safe = g_malloc (string_len);
memcpy (string_safe, string, string_len);