aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2018-10-04 17:25:55 +0200
committerAndreas Schneider <asn@cryptomilk.org>2018-10-05 14:38:43 +0200
commite701913fc8ce621bbe4ba0ed1c3aeadda01820cb (patch)
treefb387127e22cc68eb979774e09abb18298a4cc9d
parentaec9fa4442d2d5e0bc79400a084c3e308ed40644 (diff)
downloadlibssh-e701913fc8ce621bbe4ba0ed1c3aeadda01820cb.tar.gz
libssh-e701913fc8ce621bbe4ba0ed1c3aeadda01820cb.tar.xz
libssh-e701913fc8ce621bbe4ba0ed1c3aeadda01820cb.zip
agent: Just use uint32_t for the count
Signed-off-by: Andreas Schneider <asn@cryptomilk.org> Reviewed-by: Jakub Jelen <jjelen@redhat.com>
-rw-r--r--src/agent.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/agent.c b/src/agent.c
index 15a62556..96e5a69c 100644
--- a/src/agent.c
+++ b/src/agent.c
@@ -331,7 +331,7 @@ int ssh_agent_get_ident_count(struct ssh_session_struct *session) {
ssh_buffer request = NULL;
ssh_buffer reply = NULL;
unsigned int type = 0;
- uint32_t buf[1] = {0};
+ uint32_t count = 0;
int rc;
/* 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;
}
- ssh_buffer_get_u32(reply, (uint32_t *) buf);
- session->agent->count = agent_get_u32(buf);
+ rc = ssh_buffer_get_u32(reply, &count);
+ 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",
session->agent->count);
if (session->agent->count > 1024) {