--- grep-2.5.1a/src/search.c.P	2006-02-03 14:08:00.000000000 +0000
+++ grep-2.5.1a/src/search.c	2006-02-03 14:11:20.000000000 +0000
@@ -1234,8 +1234,9 @@
       char eol = eolbyte;
       if (!exact)
 	{
-	  end = memchr (end, eol, buflim - end);
-	  end++;
+	  while (end < buflim)
+	    if (*end++ == eol)
+	      break;
 	  while (buf < beg && beg[-1] != eol)
 	    --beg;
 	}