commit e870f6285d8c490536f62c6923ad0aca9844079d
Author: teor <teor2345(a)gmail.com>
Date: Thu Jun 11 01:06:15 2015 +1000
Fix clang address of struct member always non-NULL in SSL master key
clang complains that the address of struct member in an assert in
SSL_SESSION_get_master_key is always non-NULL.
Instead, check each pointer argument is non-NULL before using it.
Fix on f90a704f1258 from 27 May 2015, not in any released version of tor.
---
src/common/tortls.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/common/tortls.c b/src/common/tortls.c
index 4cfe94e..98840c1 100644
--- a/src/common/tortls.c
+++ b/src/common/tortls.c
@@ -2631,10 +2631,11 @@ SSL_get_server_random(SSL *s, uint8_t *out, size_t len)
static size_t
SSL_SESSION_get_master_key(SSL_SESSION *s, uint8_t *out, size_t len)
{
+ tor_assert(s);
if (len == 0)
return s->master_key_length;
tor_assert(len == (size_t)s->master_key_length);
- tor_assert(s->master_key);
+ tor_assert(out);
memcpy(out, s->master_key, len);
return len;
}