From 51118d1a281275059221db204fc0fa39ed5ccc50 Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Thu, 15 May 2008 14:51:43 -0600 Subject: [PATCH] Fix violation of replacement in regex. * lib/regexec.c (re_search_internal): Avoid implicit cast to bool. Reported by Heinrich Mislik . Signed-off-by: Eric Blake --- ChangeLog | 1 + lib/regexec.c | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 04ee46e7f3..fdb4b98413 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,7 @@ Fix violation of replacement in regex. * lib/regcomp.c (re_compile_internal): Avoid implicit cast to bool. + * lib/regexec.c (re_search_internal): Likewise. Reported by Heinrich Mislik . 2008-05-15 Jim Meyering diff --git a/lib/regexec.c b/lib/regexec.c index b136570820..3e51b49cfe 100644 --- a/lib/regexec.c +++ b/lib/regexec.c @@ -1,5 +1,5 @@ /* Extended regular expression matching and search library. - Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, + Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Isamu Hasegawa . @@ -701,7 +701,8 @@ re_search_internal (const regex_t *preg, fl_longest_match = (nmatch != 0 || dfa->nbackref); err = re_string_allocate (&mctx.input, string, length, dfa->nodes_len + 1, - preg->translate, preg->syntax & RE_ICASE, dfa); + preg->translate, (preg->syntax & RE_ICASE) != 0, + dfa); if (BE (err != REG_NOERROR, 0)) goto free_return; mctx.input.stop = stop; @@ -3467,7 +3468,7 @@ out_free: CONTEXT_NEWLINE); if (BE (dest_states_nl[i] == NULL && err != REG_NOERROR, 0)) goto out_free; - } + } else { dest_states_word[i] = dest_states[i]; -- 2.30.2