Fix uninitialized variable in an edge case

If `context_buf = mbedtls_calloc( 1, buf_len )` failed,
`context_buf_len` was not initialized. Noticed by
`gcc -Os -Werror=maybe-uninitialized`.

This was only a problem in ssl_server2 (a test program), only with
MBEDTLS_SSL_CONTEXT_SERIALIZATION enabled.
This commit is contained in:
Gilles Peskine 2019-09-20 19:12:31 +02:00
parent 2fdb1af18c
commit 4e8b594002

View file

@ -1820,7 +1820,7 @@ int main( int argc, char *argv[] )
#endif #endif
#if defined(MBEDTLS_SSL_CONTEXT_SERIALIZATION) #if defined(MBEDTLS_SSL_CONTEXT_SERIALIZATION)
unsigned char *context_buf = NULL; unsigned char *context_buf = NULL;
size_t context_buf_len; size_t context_buf_len = 0;
#endif #endif
int i; int i;