=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/grep/util.c,v retrieving revision 1.23 retrieving revision 1.24 diff -u -r1.23 -r1.24 --- src/usr.bin/grep/util.c 2004/01/26 14:50:29 1.23 +++ src/usr.bin/grep/util.c 2004/02/04 18:38:52 1.24 @@ -1,4 +1,4 @@ -/* $OpenBSD: util.c,v 1.23 2004/01/26 14:50:29 millert Exp $ */ +/* $OpenBSD: util.c,v 1.24 2004/02/04 18:38:52 millert Exp $ */ /*- * Copyright (c) 1999 James Howard and Dag-Erling Coïdan Smørgrav @@ -266,9 +266,9 @@ } /* Remove enclosing [[:<:]] and [[:>:]] (word match). */ - if (fg->patternLen > 14 + fg->bol + fg->eol && + if (fg->patternLen >= 14 && strncmp(pattern + fg->bol, "[[:<:]]", 7) == 0 && - strncmp(pattern + fg->patternLen - (7 + fg->eol), "[[:>:]]", 7) == 0) { + strncmp(pattern + fg->bol + fg->patternLen - 7, "[[:>:]]", 7) == 0) { fg->patternLen -= 14; fg->wmatch = 7; }