From 8c72a9daa4fffe989d6d342838f650a923058a86 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Wed, 7 Sep 2022 14:45:35 +0100 Subject: [PATCH] Windows Pageant: add a missing null-pointer check (maybe). Coverity complained in keylist_update_callback that in one if statement I was allowing for the possibility that alg == NULL, and in the next, I was assuming it would always be non-null. Right now I'm not actually convinced that _either_ check is necessary - it would make sense in an agent _client_, where you might be talking to an agent that knows key algorithms you don't, but this is the GUI built into Pageant itself, so any key it can store internally ought to have a known algorithm name. Still, this fix is certainly _correct_ even if not optimal, and it'll do for now. --- windows/pageant.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/windows/pageant.c b/windows/pageant.c index 60040310..d1368903 100644 --- a/windows/pageant.c +++ b/windows/pageant.c @@ -375,7 +375,7 @@ static void keylist_update_callback( } ptrlen bits_word = ptrlen_get_word(&fingerprint, " "); - if (ssh_keyalg_variable_size(alg)) + if (alg && ssh_keyalg_variable_size(alg)) put_datapl(disp->bits, bits_word); put_datapl(disp->hash, ptrlen_get_word(&fingerprint, " "));