From eaa93942902485744c1ae0724a68efb2d814cb2d Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Mon, 24 May 2010 10:53:29 +0200 Subject: [PATCH] Fix bug: Avoid out-of-bounds access. --- gettext-tools/libgrep/ChangeLog | 6 ++++++ gettext-tools/libgrep/m-regex.c | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/gettext-tools/libgrep/ChangeLog b/gettext-tools/libgrep/ChangeLog index a229582f6..0e3951701 100644 --- a/gettext-tools/libgrep/ChangeLog +++ b/gettext-tools/libgrep/ChangeLog @@ -1,3 +1,9 @@ +2010-05-24 Bruno Haible + + Fix bug: Avoid out-of-bounds access. + * m-regex.c (EGexecute): Fix test before second call to + IS_WORD_CONSTITUENT. + 2010-05-24 Bruno Haible Cleanup syntax. diff --git a/gettext-tools/libgrep/m-regex.c b/gettext-tools/libgrep/m-regex.c index d4b49b98c..e3582bcb4 100644 --- a/gettext-tools/libgrep/m-regex.c +++ b/gettext-tools/libgrep/m-regex.c @@ -193,7 +193,7 @@ EGexecute (const void *compiled_pattern, while (start >= 0) { if ((start == 0 || !IS_WORD_CONSTITUENT ((unsigned char) beg[start - 1])) - && (len == end - beg + && (start + len == end - beg || !IS_WORD_CONSTITUENT ((unsigned char) beg[start + len]))) goto success; if (len > 0) -- 2.47.2