--- agrep/sgrep.c.orig Mon Apr 26 23:15:06 2004 +++ agrep/sgrep.c Mon Apr 26 23:15:33 2004 @@ -1539,7 +1539,7 @@ hash = TR[*text]; hash = (hash << 3) + TR[*(text-1)]; shift = SHIFT_2[hash]; - while(shift) { + while(shift && text <= textend) { text = text + shift; hash = (TR[*text] << 3) + TR[*(text-1)]; shift = SHIFT_2[hash];