diff options
author | Damien Miller <djm@mindrot.org> | 2012-02-11 08:17:52 +1100 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2012-02-11 08:17:52 +1100 |
commit | fb12c6d8bb6515512c3cd00dfcb2670a6c54ba49 (patch) | |
tree | 53a5ff3ee27c9f41d78609ad8174a8f49dd9969a /ssh-pkcs11-client.c | |
parent | 83ba8e6056af5836ef57d6d24940c4f1681262fd (diff) |
- miod@cvs.openbsd.org 2012/01/16 20:34:09
[ssh-pkcs11-client.c]
Fix a memory leak in pkcs11_rsa_private_encrypt(), reported by Jan Klemkow.
While there, be sure to buffer_clear() between send_msg() and recv_msg().
ok markus@
Diffstat (limited to 'ssh-pkcs11-client.c')
-rw-r--r-- | ssh-pkcs11-client.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/ssh-pkcs11-client.c b/ssh-pkcs11-client.c index 650c37342..82b11daf5 100644 --- a/ssh-pkcs11-client.c +++ b/ssh-pkcs11-client.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ssh-pkcs11-client.c,v 1.2 2010/02/24 06:12:53 djm Exp $ */ | 1 | /* $OpenBSD: ssh-pkcs11-client.c,v 1.3 2012/01/16 20:34:09 miod Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2010 Markus Friedl. All rights reserved. | 3 | * Copyright (c) 2010 Markus Friedl. All rights reserved. |
4 | * | 4 | * |
@@ -123,6 +123,7 @@ pkcs11_rsa_private_encrypt(int flen, const u_char *from, u_char *to, RSA *rsa, | |||
123 | buffer_put_int(&msg, 0); | 123 | buffer_put_int(&msg, 0); |
124 | xfree(blob); | 124 | xfree(blob); |
125 | send_msg(&msg); | 125 | send_msg(&msg); |
126 | buffer_clear(&msg); | ||
126 | 127 | ||
127 | if (recv_msg(&msg) == SSH2_AGENT_SIGN_RESPONSE) { | 128 | if (recv_msg(&msg) == SSH2_AGENT_SIGN_RESPONSE) { |
128 | signature = buffer_get_string(&msg, &slen); | 129 | signature = buffer_get_string(&msg, &slen); |
@@ -132,6 +133,7 @@ pkcs11_rsa_private_encrypt(int flen, const u_char *from, u_char *to, RSA *rsa, | |||
132 | } | 133 | } |
133 | xfree(signature); | 134 | xfree(signature); |
134 | } | 135 | } |
136 | buffer_free(&msg); | ||
135 | return (ret); | 137 | return (ret); |
136 | } | 138 | } |
137 | 139 | ||