From c811b8f3a0a3ec2a071983d6952350f521c8b28d Mon Sep 17 00:00:00 2001 From: Sebastian Hahn Date: Fri, 2 Dec 2011 06:16:47 +0100 Subject: [PATCH 1/2] Appease check-spaces --- src/test/test_config.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/test_config.c b/src/test/test_config.c index 4ce0fa8459..d8161de14c 100644 --- a/src/test/test_config.c +++ b/src/test/test_config.c @@ -156,7 +156,7 @@ test_config_addressmap(void *arg) strlcpy(address, "www.torproject.org", sizeof(address)); test_assert(!addressmap_rewrite(address, sizeof(address), &expires)); -done: + done: ; } From 95af91565bd846be0b199fbc02d7197bf771e867 Mon Sep 17 00:00:00 2001 From: Sebastian Hahn Date: Fri, 2 Dec 2011 06:15:31 +0100 Subject: [PATCH 2/2] Work around a false positive in Coverity. Fixes cid 501 and 502. --- src/common/crypto.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/common/crypto.c b/src/common/crypto.c index 62b0bcec6c..2aa3fc97a5 100644 --- a/src/common/crypto.c +++ b/src/common/crypto.c @@ -1912,9 +1912,12 @@ crypto_get_stored_dynamic_dh_modulus(const char *fname) } /* 'fname' contains the DH parameters stored in base64-ed DER - format. We are only interested in the DH modulus. */ + * format. We are only interested in the DH modulus. + * NOTE: We allocate more storage here than we need. Since we're already + * doing that, we can also add 1 byte extra to appease Coverity's + * scanner. */ - cp = base64_decoded_dh = tor_malloc_zero(strlen(contents)); + cp = base64_decoded_dh = tor_malloc_zero(strlen(contents) + 1); length = base64_decode((char *)base64_decoded_dh, strlen(contents), contents, strlen(contents)); if (length < 0) {