[or-cvs] r17485: {tor} Add a couple of sanity-checks for return values that coverit (tor/trunk/src/or)

nickm at seul.org nickm at seul.org
Fri Dec 5 01:35:49 UTC 2008


Author: nickm
Date: 2008-12-04 20:35:49 -0500 (Thu, 04 Dec 2008)
New Revision: 17485

Modified:
   tor/trunk/src/or/routerparse.c
   tor/trunk/src/or/test.c
Log:
Add a couple of sanity-checks for return values that coverity thinks we ought to have.  CIDs 337, 335.

Modified: tor/trunk/src/or/routerparse.c
===================================================================
--- tor/trunk/src/or/routerparse.c	2008-12-05 01:29:59 UTC (rev 17484)
+++ tor/trunk/src/or/routerparse.c	2008-12-05 01:35:49 UTC (rev 17485)
@@ -2552,6 +2552,7 @@
   }
 
   tok = find_first_by_keyword(tokens, K_CONSENSUS_DIGEST);
+  tor_assert(tok);
   if (strlen(tok->args[0]) != HEX_DIGEST_LEN) {
     log_warn(LD_DIR, "Wrong length on consensus-digest in detached "
              "networkstatus signatures");

Modified: tor/trunk/src/or/test.c
===================================================================
--- tor/trunk/src/or/test.c	2008-12-05 01:29:59 UTC (rev 17484)
+++ tor/trunk/src/or/test.c	2008-12-05 01:35:49 UTC (rev 17485)
@@ -763,6 +763,7 @@
   memset(data1, 6, 1024);
   for (idx = 0; idx < 10; ++idx) {
     i = base64_encode(data2, 1024, data1, idx);
+    test_assert(i >= 0);
     j = base64_decode(data3, 1024, data2, i);
     test_eq(j,idx);
     test_memeq(data3, data1, idx);



More information about the tor-commits mailing list