mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-08-08 19:02:06 +03:00
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>
This commit is contained in:
committed by
Andreas Schneider
parent
7edbedf0dd
commit
59da8dab50
15
src/pki.c
15
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),
|
||||
|
Reference in New Issue
Block a user