1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-11-30 13:01:23 +03:00

agent: Just use uint32_t for the count

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
This commit is contained in:
Andreas Schneider
2018-10-04 17:25:55 +02:00
parent aec9fa4442
commit e701913fc8

View File

@@ -331,7 +331,7 @@ int ssh_agent_get_ident_count(struct ssh_session_struct *session) {
ssh_buffer request = NULL; ssh_buffer request = NULL;
ssh_buffer reply = NULL; ssh_buffer reply = NULL;
unsigned int type = 0; unsigned int type = 0;
uint32_t buf[1] = {0}; uint32_t count = 0;
int rc; int rc;
/* send message to the agent requesting the list of identities */ /* send message to the agent requesting the list of identities */
@@ -386,8 +386,15 @@ int ssh_agent_get_ident_count(struct ssh_session_struct *session) {
return -1; return -1;
} }
ssh_buffer_get_u32(reply, (uint32_t *) buf); rc = ssh_buffer_get_u32(reply, &count);
session->agent->count = agent_get_u32(buf); if (rc != 4) {
ssh_set_error(session,
SSH_FATAL,
"Failed to read count");
ssh_buffer_free(reply);
return -1;
}
session->agent->count = ntohl(count);
SSH_LOG(SSH_LOG_DEBUG, "Agent count: %d", SSH_LOG(SSH_LOG_DEBUG, "Agent count: %d",
session->agent->count); session->agent->count);
if (session->agent->count > 1024) { if (session->agent->count > 1024) {