Use memset to clear SRP_CTX instead of NULL and zero assignments
authorDiego Santa Cruz <Diego.SantaCruz@spinetix.com>
Tue, 16 May 2017 08:35:49 +0000 (10:35 +0200)
committerMatt Caswell <matt@openssl.org>
Thu, 8 Jun 2017 20:04:20 +0000 (21:04 +0100)
commit3ff170c6a137c330bb23731f1193c5005e9b85a9
tree018bcf04be3bd429a6af97f447c1d99611638fc2
parent0f2e444ee5cf1a2de68ab8edf2df376512f2508f
Use memset to clear SRP_CTX instead of NULL and zero assignments

This uses memset() to clear all of the SRP_CTX when free'ing or
initializing it as well as in error paths instead of having a series
of NULL and zero assignments as it is safer.

It also changes SSL_SRP_CTX_init() to reset all the SRP_CTX to zero
in case or error, previously it could retain pointers to freed
memory, potentially leading to a double free.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3467)

(cherry picked from commit 135976b3dd24e674c202c20b5746fc04ebb1fc1a)
ssl/tls_srp.c