Add safety checks for all ssh_string_fill calls

These calls can fail and the return code should always be checked. These
issues were identified when code review called it out on new code. The
updates here are to existing code with no behavior changes to make
review simpler.

Signed-off-by: Dirkjan Bussink <d.bussink@gmail.com>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
Dirkjan Bussink
2020-12-10 14:01:32 +00:00
committed by Andreas Schneider
parent f6a2f6190c
commit daeee74edd
8 changed files with 97 additions and 30 deletions

View File

@@ -68,7 +68,9 @@ static void torture_session_keys(UNUSED_PARAM(void **state))
int rc;
k_string = ssh_string_new(32);
ssh_string_fill(k_string, key, 32);
rc = ssh_string_fill(k_string, key, 32);
assert_int_equal(rc, 0);
test_crypto.shared_secret = ssh_make_string_bn(k_string);
rc = ssh_generate_session_keys(&session);