1
1

auth: Fix possible NULL pointer dereference

explicit_bzero() doesn't handle NULL.

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Этот коммит содержится в:
Andreas Schneider 2018-08-24 15:49:16 +02:00
родитель 4de8ed684b
Коммит 8f1e995cec

Просмотреть файл

@ -1228,7 +1228,9 @@ void ssh_kbdint_free(ssh_kbdint kbd) {
n = kbd->nprompts; n = kbd->nprompts;
if (kbd->prompts) { if (kbd->prompts) {
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
explicit_bzero(kbd->prompts[i], strlen(kbd->prompts[i])); if (kbd->prompts[i] != NULL) {
explicit_bzero(kbd->prompts[i], strlen(kbd->prompts[i]));
}
SAFE_FREE(kbd->prompts[i]); SAFE_FREE(kbd->prompts[i]);
} }
SAFE_FREE(kbd->prompts); SAFE_FREE(kbd->prompts);
@ -1237,7 +1239,9 @@ void ssh_kbdint_free(ssh_kbdint kbd) {
n = kbd->nanswers; n = kbd->nanswers;
if (kbd->answers) { if (kbd->answers) {
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
explicit_bzero(kbd->answers[i], strlen(kbd->answers[i])); if (kbd->answers[i] != NULL) {
explicit_bzero(kbd->answers[i], strlen(kbd->answers[i]));
}
SAFE_FREE(kbd->answers[i]); SAFE_FREE(kbd->answers[i]);
} }
SAFE_FREE(kbd->answers); SAFE_FREE(kbd->answers);