aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJon Simons <jon@jonsimons.org>2014-09-27 02:07:54 -0700
committerAndreas Schneider <asn@cryptomilk.org>2014-10-02 08:28:05 +0200
commit59da8dab50ef57471b0277791fd26b90852601e5 (patch)
tree893740731bf9cfeafe7427053960420792e45088 /src
parent7edbedf0dd21657f5aefd0db5cb212330b8b2355 (diff)
downloadlibssh-59da8dab50ef57471b0277791fd26b90852601e5.tar.gz
libssh-59da8dab50ef57471b0277791fd26b90852601e5.tar.xz
libssh-59da8dab50ef57471b0277791fd26b90852601e5.zip
pki: check ssh_buffer_pack return in ssh_pki_do_sign
Check the 'ssh_buffer_pack' return in ssh_pki_do_sign for the ED25519 case. Signed-off-by: Jon Simons <jon@jonsimons.org> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'src')
-rw-r--r--src/pki.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/pki.c b/src/pki.c
index cde803e6..af472ebb 100644
--- a/src/pki.c
+++ b/src/pki.c
@@ -1453,16 +1453,21 @@ ssh_string ssh_pki_do_sign(ssh_session session,
ssh_buffer buf;
buf = ssh_buffer_new();
- if (buf == NULL){
+ if (buf == NULL) {
ssh_string_free(session_id);
return NULL;
}
ssh_buffer_set_secure(buf);
- ssh_buffer_pack(buf,
- "SP",
- session_id,
- buffer_get_rest_len(sigbuf), buffer_get_rest(sigbuf));
+ rc = ssh_buffer_pack(buf,
+ "SP",
+ session_id,
+ buffer_get_rest_len(sigbuf), buffer_get_rest(sigbuf));
+ if (rc != SSH_OK) {
+ ssh_string_free(session_id);
+ ssh_buffer_free(buf);
+ return NULL;
+ }
sig = pki_do_sign(privkey,
ssh_buffer_get_begin(buf),