summaryrefslogtreecommitdiff
path: root/src/or/routerparse.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2008-02-19 23:29:45 +0000
committerNick Mathewson <nickm@torproject.org>2008-02-19 23:29:45 +0000
commit42c4670e27fe5bdc694875cddedc5151fe8c5244 (patch)
tree56968be60690d89f055663a65a2d67819f43eb89 /src/or/routerparse.c
parent319c0d89337312aa553a21c39dbba8eafd385e53 (diff)
downloadtor-42c4670e27fe5bdc694875cddedc5151fe8c5244.tar.gz
tor-42c4670e27fe5bdc694875cddedc5151fe8c5244.zip
r18230@catbus: nickm | 2008-02-19 18:29:43 -0500
Add a few asserts to catch possible errors found by veracode. svn:r13598
Diffstat (limited to 'src/or/routerparse.c')
-rw-r--r--src/or/routerparse.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/or/routerparse.c b/src/or/routerparse.c
index d4ce7bf7f9..9a22a0ed61 100644
--- a/src/or/routerparse.c
+++ b/src/or/routerparse.c
@@ -1126,13 +1126,15 @@ router_parse_entry_from_string(const char *s, const char *end,
router->cache_info.signed_descriptor_len = end-s;
if (cache_copy) {
size_t len = router->cache_info.signed_descriptor_len +
- router->cache_info.annotations_len;
+ router->cache_info.annotations_len;
char *cp =
router->cache_info.signed_descriptor_body = tor_malloc(len+1);
if (prepend_annotations) {
memcpy(cp, prepend_annotations, prepend_len);
cp += prepend_len;
}
+ tor_assert(cp+(end-start_of_annotations) ==
+ router->cache_info.signed_descriptor_body+len);
memcpy(cp, start_of_annotations, end-start_of_annotations);
router->cache_info.signed_descriptor_body[len] = '\0';
tor_assert(strlen(router->cache_info.signed_descriptor_body) == len);