mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-01 19:42:48 -05:00
winpgnt: fix GUI removal of encrypted keys.
The GUI loop that responded to the 'Remove Key' button in the key list worked by actually trying to retrieve a pointer to the ssh_key for a stored key, and then passing that back to the delete function. But when a key is encrypted, that pointer is NULL, so we segfaulted. Fixed by changing pageant_delete_ssh2_key() to take a numeric index in the list instead of a key pointer.
This commit is contained in:
@ -505,9 +505,6 @@ static void prompt_add_keyfile(bool encrypted)
|
||||
static INT_PTR CALLBACK KeyListProc(HWND hwnd, UINT msg,
|
||||
WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
RSAKey *rkey;
|
||||
ssh2_userkey *skey;
|
||||
|
||||
static const struct {
|
||||
const char *name;
|
||||
FingerprintType value;
|
||||
@ -615,24 +612,16 @@ static INT_PTR CALLBACK KeyListProc(HWND hwnd, UINT msg,
|
||||
* things hence altering the offset of subsequent items
|
||||
*/
|
||||
for (i = sCount - 1; (itemNum >= 0) && (i >= 0); i--) {
|
||||
skey = pageant_nth_ssh2_key(i);
|
||||
|
||||
if (selectedArray[itemNum] == rCount + i) {
|
||||
pageant_delete_ssh2_key(skey);
|
||||
ssh_key_free(skey->key);
|
||||
sfree(skey);
|
||||
pageant_delete_nth_ssh2_key(i);
|
||||
itemNum--;
|
||||
}
|
||||
}
|
||||
|
||||
/* do the same for the rsa keys */
|
||||
for (i = rCount - 1; (itemNum >= 0) && (i >= 0); i--) {
|
||||
rkey = pageant_nth_ssh1_key(i);
|
||||
|
||||
if(selectedArray[itemNum] == i) {
|
||||
pageant_delete_ssh1_key(rkey);
|
||||
freersakey(rkey);
|
||||
sfree(rkey);
|
||||
pageant_delete_nth_ssh1_key(i);
|
||||
itemNum--;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user