summaryrefslogtreecommitdiff
path: root/usr.bin/grep/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/grep/util.c')
-rw-r--r--usr.bin/grep/util.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/usr.bin/grep/util.c b/usr.bin/grep/util.c
index 6c6d5d25063..8a08e15926d 100644
--- a/usr.bin/grep/util.c
+++ b/usr.bin/grep/util.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: util.c,v 1.31 2006/02/09 09:54:47 otto Exp $ */
+/* $OpenBSD: util.c,v 1.32 2006/09/26 15:55:17 jaredy Exp $ */
/*-
* Copyright (c) 1999 James Howard and Dag-Erling Coïdan Smørgrav
@@ -479,8 +479,9 @@ grep_search(fastgrep_t *fg, unsigned char *data, size_t dataLen, regmatch_t *pma
if (grep_cmp(fg->pattern, data + j, fg->patternLen) == -1) {
pmatch->rm_so = j;
pmatch->rm_eo = j + fg->patternLen;
- if (!fg->wmatch || wmatch(data, dataLen,
- pmatch->rm_so, pmatch->rm_eo)) {
+ if (fg->patternLen == 0 || !fg->wmatch ||
+ wmatch(data, dataLen, pmatch->rm_so,
+ pmatch->rm_eo)) {
rtrnVal = 0;
break;
}