summaryrefslogtreecommitdiff
path: root/libc/posix/regex_internal.c
diff options
context:
space:
mode:
Diffstat (limited to 'libc/posix/regex_internal.c')
-rw-r--r--libc/posix/regex_internal.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libc/posix/regex_internal.c b/libc/posix/regex_internal.c
index a7d528ff6..6b1981a5f 100644
--- a/libc/posix/regex_internal.c
+++ b/libc/posix/regex_internal.c
@@ -1,5 +1,5 @@
/* Extended regular expression matching and search library.
- Copyright (C) 2002-2006, 2010 Free Software Foundation, Inc.
+ Copyright (C) 2002-2006, 2010, 2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>.
@@ -737,16 +737,18 @@ re_string_reconstruct (re_string_t *pstr, int idx, int eflags)
unsigned char buf[6];
size_t mbclen;
+ const unsigned char *pp = p;
if (BE (pstr->trans != NULL, 0))
{
int i = mlen < 6 ? mlen : 6;
while (--i >= 0)
buf[i] = pstr->trans[p[i]];
+ pp = buf;
}
/* XXX Don't use mbrtowc, we know which conversion
to use (UTF-8 -> UCS4). */
memset (&cur_state, 0, sizeof (cur_state));
- mbclen = __mbrtowc (&wc2, (const char *) p, mlen,
+ mbclen = __mbrtowc (&wc2, (const char *) pp, mlen,
&cur_state);
if (raw + offset - p <= mbclen
&& mbclen < (size_t) -2)