summaryrefslogtreecommitdiff
path: root/src/or/test.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2008-02-21 02:10:38 +0000
committerNick Mathewson <nickm@torproject.org>2008-02-21 02:10:38 +0000
commit0e9dcfab97de3c9d9f608deb67bcdc866ae52c93 (patch)
tree5c8fefbbd2408a31124a78bd48edc8e10fe31553 /src/or/test.c
parent3b58f9929f947f2c21a6bfe439d9b0819a9900fe (diff)
downloadtor-0e9dcfab97de3c9d9f608deb67bcdc866ae52c93.tar.gz
tor-0e9dcfab97de3c9d9f608deb67bcdc866ae52c93.zip
r18286@catbus: nickm | 2008-02-20 21:10:33 -0500
Fix a bug that kept buf_find_string_offset from finding a string at the very end of the buffer. Add a unit test for this. Also, do not save a pointer to a chunk that might get reallocated by buf_pullup(). svn:r13635
Diffstat (limited to 'src/or/test.c')
-rw-r--r--src/or/test.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/or/test.c b/src/or/test.c
index f68bc97efa..c18eccff66 100644
--- a/src/or/test.c
+++ b/src/or/test.c
@@ -267,6 +267,7 @@ test_buffers(void)
test_eq(39, buf_find_string_offset(buf, "ing str", 7));
test_eq(35, buf_find_string_offset(buf, "Testing str", 11));
test_eq(32, buf_find_string_offset(buf, "ng ", 3));
+ test_eq(43, buf_find_string_offset(buf, "string.", 7));
test_eq(-1, buf_find_string_offset(buf, "shrdlu", 6));
test_eq(-1, buf_find_string_offset(buf, "Testing thing", 13));
test_eq(-1, buf_find_string_offset(buf, "ngx", 3));