Better fix for scan-build warning regarding possible use of NULL in AddRecordHeader. Scan-build considers paths where output is set to NULL, but ssl->spec.kea is corrupted/changed, which could result in output == NULL (even though it should never happen). So added proper NULL check in SendServerKeyExchange on AddHeader to make sure output isn't NULL.

This commit is contained in:
David Garske
2016-04-01 12:57:33 -07:00
parent 19f0769ec4
commit 2d4aa1bbb5

View File

@ -15468,8 +15468,15 @@ int DoSessionTicket(WOLFSSL* ssl,
#endif
#if defined(HAVE_ECC)
if (ssl->specs.kea == ecdhe_psk_kea || ssl->specs.kea == ecc_diffie_hellman_kea) {
AddHeaders(output, length, server_key_exchange, ssl);
if (ssl->specs.kea == ecdhe_psk_kea ||
ssl->specs.kea == ecc_diffie_hellman_kea) {
/* Check output to make sure it was set */
if (output) {
AddHeaders(output, length, server_key_exchange, ssl);
}
else {
ERROR_OUT(BUFFER_ERROR, exit_sske);
}
}
#endif /* HAVE_ECC */