From 6a3e4a89a24fc1e776b84f55ff884b88ef78ceb3 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Wed, 31 Aug 2011 22:14:38 -0400 Subject: Tweaks on last process-launch patches --- src/common/util.c | 1 + src/test/test_util.c | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common/util.c b/src/common/util.c index 30c298e0d..7cd9dd8e0 100644 --- a/src/common/util.c +++ b/src/common/util.c @@ -3616,6 +3616,7 @@ tor_read_all_handle(FILE *h, char *buf, size_t count, } } tor_assert(retval != NULL); + tor_assert(strlen(retval) + numread <= count); numread += strlen(retval); } diff --git a/src/test/test_util.c b/src/test/test_util.c index 336f95b14..06c1be3e3 100644 --- a/src/test/test_util.c +++ b/src/test/test_util.c @@ -1647,8 +1647,7 @@ test_util_split_lines(void *ptr) for (i=0; tests[i].orig_line; i++) { sl = smartlist_create(); /* Allocate space for string and trailing NULL */ - orig_line = tor_malloc(tests[i].orig_length + 1); - memcpy(orig_line, tests[i].orig_line, tests[i].orig_length + 1); + orig_line = tor_memdup(tests[i].orig_line, tests[i].orig_length + 1); tor_split_lines(sl, orig_line, tests[i].orig_length); j = 0; -- cgit v1.2.3