aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2013-12-11 15:14:43 -0500
committerNick Mathewson <nickm@torproject.org>2014-04-07 22:56:42 -0400
commit9dd115d6b59aaa7d2f444efb9d7992e472fbfb0f (patch)
treea348392d08ba971798ea3dbb6d78f35e9165521b /src/test
parent092ac26ea28c17d13bd1d01cab9b3dec276c4dbc (diff)
downloadtor-9dd115d6b59aaa7d2f444efb9d7992e472fbfb0f.tar
tor-9dd115d6b59aaa7d2f444efb9d7992e472fbfb0f.tar.gz
Another 10363 instance: this one in tor_memmem fallback code
Diffstat (limited to 'src/test')
-rw-r--r--src/test/test_util.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/test/test_util.c b/src/test/test_util.c
index 65d9d2f87..bf87db70b 100644
--- a/src/test/test_util.c
+++ b/src/test/test_util.c
@@ -1045,6 +1045,10 @@ test_util_strmisc(void)
test_assert(!tor_memmem(haystack, 4, "cde", 3));
haystack = "ababcad";
test_eq_ptr(tor_memmem(haystack, 7, "abc", 3), haystack + 2);
+ test_eq_ptr(tor_memmem(haystack, 7, "ad", 2), haystack + 5);
+ test_eq_ptr(tor_memmem(haystack, 7, "cad", 3), haystack + 4);
+ test_assert(!tor_memmem(haystack, 7, "dadad", 5));
+ test_assert(!tor_memmem(haystack, 7, "abcdefghij", 10));
/* memstr */
test_eq_ptr(tor_memstr(haystack, 7, "abc"), haystack + 2);
test_eq_ptr(tor_memstr(haystack, 7, "cad"), haystack + 4);