aboutsummaryrefslogtreecommitdiff
path: root/src/or/rendcommon.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2009-10-26 21:59:34 -0400
committerNick Mathewson <nickm@torproject.org>2009-10-26 22:40:41 -0400
commit5e4d53d535a3cc9903250b3df0caa829f1c5e4bf (patch)
treedcbab7d722ce4d818f6666365ac3d6aecdf9df24 /src/or/rendcommon.c
parentcec698d29ed51ed219f907e12538e6945e535e4a (diff)
downloadtor-5e4d53d535a3cc9903250b3df0caa829f1c5e4bf.tar
tor-5e4d53d535a3cc9903250b3df0caa829f1c5e4bf.tar.gz
Remove checks for array existence. (CID 410..415)
In C, the code "char x[10]; if (x) {...}" always takes the true branch of the if statement. Coverity notices this now. In some cases, we were testing arrays to make sure that an operation we wanted to do would suceed. Those cases are now always-true. In some cases, we were testing arrays to see if something was _set_. Those caes are now tests for strlen(s), or tests for !tor_mem_is_zero(d,len).
Diffstat (limited to 'src/or/rendcommon.c')
-rw-r--r--src/or/rendcommon.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/or/rendcommon.c b/src/or/rendcommon.c
index c7eb2a9d0..9055f981b 100644
--- a/src/or/rendcommon.c
+++ b/src/or/rendcommon.c
@@ -1245,7 +1245,8 @@ rend_cache_store_v2_desc_as_client(const char *desc,
/* Decode/decrypt introduction points. */
if (intro_content) {
if (rend_query->auth_type != REND_NO_AUTH &&
- rend_query->descriptor_cookie) {
+ !tor_mem_is_zero(rend_query->descriptor_cookie,
+ sizeof(rend_query->descriptor_cookie))) {
char *ipos_decrypted = NULL;
size_t ipos_decrypted_size;
if (rend_decrypt_introduction_points(&ipos_decrypted,