Remove an NULL ptr deref in an error path
The |passwd| variable in the code can be NULL if it goes to the err label.
Therefore we cannot call strlen on it without first checking that it is non
NULL.
Reviewed-by: Kurt Roeckx <kurt@openssl.org>
diff --git a/ssl/tls_srp.c b/ssl/tls_srp.c
index 91b88cd..64a3f23 100644
--- a/ssl/tls_srp.c
+++ b/ssl/tls_srp.c
@@ -393,7 +393,8 @@
err:
BN_clear_free(K);
BN_clear_free(x);
- OPENSSL_clear_free(passwd, strlen(passwd));
+ if (passwd != NULL)
+ OPENSSL_clear_free(passwd, strlen(passwd));
BN_clear_free(u);
return ret;
}