mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-09 09:54:25 +09:00
auth: Use calloc to allocate memory
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
(cherry picked from commit 1e195a232a)
This commit is contained in:
@@ -1545,7 +1545,7 @@ SSH_PACKET_CALLBACK(ssh_packet_userauth_info_request) {
|
|||||||
return SSH_PACKET_USED;
|
return SSH_PACKET_USED;
|
||||||
}
|
}
|
||||||
|
|
||||||
session->kbdint->echo = malloc(nprompts);
|
session->kbdint->echo = calloc(nprompts, sizeof(unsigned char));
|
||||||
if (session->kbdint->echo == NULL) {
|
if (session->kbdint->echo == NULL) {
|
||||||
session->kbdint->nprompts = 0;
|
session->kbdint->nprompts = 0;
|
||||||
ssh_set_error_oom(session);
|
ssh_set_error_oom(session);
|
||||||
@@ -1554,7 +1554,6 @@ SSH_PACKET_CALLBACK(ssh_packet_userauth_info_request) {
|
|||||||
|
|
||||||
return SSH_PACKET_USED;
|
return SSH_PACKET_USED;
|
||||||
}
|
}
|
||||||
memset(session->kbdint->echo, 0, nprompts);
|
|
||||||
|
|
||||||
for (i = 0; i < nprompts; i++) {
|
for (i = 0; i < nprompts; i++) {
|
||||||
rc = ssh_buffer_unpack(packet, "sb",
|
rc = ssh_buffer_unpack(packet, "sb",
|
||||||
|
|||||||
Reference in New Issue
Block a user