aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2011-12-02 00:24:33 -0500
committerNick Mathewson <nickm@torproject.org>2011-12-02 00:24:33 -0500
commitcd10013218a6b1cc42568eb91ed9372e6caddf1f (patch)
treeec791eec924559c40db3e008f1566331714222e7 /src
parent5ffa7102c00385445d3855bbc481668edf62d139 (diff)
parent95af91565bd846be0b199fbc02d7197bf771e867 (diff)
downloadtor-cd10013218a6b1cc42568eb91ed9372e6caddf1f.tar.gz
tor-cd10013218a6b1cc42568eb91ed9372e6caddf1f.zip
Merge remote-tracking branch 'sebastian/coverity_strlen_fp'
Diffstat (limited to 'src')
-rw-r--r--src/common/crypto.c7
-rw-r--r--src/test/test_config.c2
2 files changed, 6 insertions, 3 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) {
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:
;
}