ssl_srv.c: initialize flags on each iteration of the loop

Although the 'flags' variable is not checked or used after a call to
mbedtls_ssl_check_cert_usage, it might be in the future. With this fix, after
each iteration, the flags will apply only to the most recent certificate, not
to any of the previous ones checked. This fix also stops any reads and 
writes via a '|=' from/to an uninitialized variable happening.
This commit fixes #2444.
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
This commit is contained in:
Andrzej Kurek 2020-03-18 11:51:59 -04:00
parent 21d1cbccda
commit 7ed01e8c68
No known key found for this signature in database
GPG Key ID: 89A90840DC388527

View File

@ -840,6 +840,7 @@ static int ssl_pick_cert( mbedtls_ssl_context *ssl,
for( cur = list; cur != NULL; cur = cur->next )
{
flags = 0;
MBEDTLS_SSL_DEBUG_CRT( 3, "candidate certificate chain, certificate",
cur->cert );