[or-cvs] Fix bug with tor_memmem finding a match at the end of the s...

Nick Mathewson nickm at seul.org
Mon Aug 22 00:34:25 UTC 2005


Update of /home/or/cvsroot/tor/src/common
In directory moria:/tmp/cvs-serv24674/src/common

Modified Files:
	compat.c 
Log Message:
Fix bug with tor_memmem finding a match at the end of the string.

Index: compat.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/common/compat.c,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -d -r1.63 -r1.64
--- compat.c	3 Aug 2005 17:16:48 -0000	1.63
+++ compat.c	22 Aug 2005 00:34:23 -0000	1.64
@@ -161,7 +161,7 @@
   end = haystack + hlen;
   first = *(const char*)needle;
   while ((p = memchr(p, first, end-p))) {
-    if (p+nlen >= end)
+    if (p+nlen > end)
       return NULL;
     if (!memcmp(p, needle, nlen))
       return p;



More information about the tor-commits mailing list