]> asedeno.scripts.mit.edu Git - PuTTY.git/commitdiff
Fix the inverted return values in pageant_add_ssh*_key().
authorSimon Tatham <anakin@pobox.com>
Thu, 7 May 2015 17:41:06 +0000 (18:41 +0100)
committerSimon Tatham <anakin@pobox.com>
Thu, 7 May 2015 17:42:33 +0000 (18:42 +0100)
This would have caused intermittent use-after-free crashes in Windows
Pageant, but only with keys added via the primary Pageant's own UI or
command line - not keys submitted from another process, because those
don't go through the same function.

pageant.c

index 33d0d30594bbc30c25453b4f60c9dffe9729f0b0..495124a57d25ae4c1879374c9694ee45cdc85372 100644 (file)
--- a/pageant.c
+++ b/pageant.c
@@ -954,12 +954,12 @@ int pageant_count_ssh2_keys(void)
 
 int pageant_add_ssh1_key(struct RSAKey *rkey)
 {
-    return add234(rsakeys, rkey) != rkey;
+    return add234(rsakeys, rkey) == rkey;
 }
 
 int pageant_add_ssh2_key(struct ssh2_userkey *skey)
 {
-    return add234(ssh2keys, skey) != skey;
+    return add234(ssh2keys, skey) == skey;
 }
 
 int pageant_delete_ssh1_key(struct RSAKey *rkey)