From 78498ee289f7001f0365ea11895214d36427d3d3 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Mon, 3 Sep 2018 18:04:15 +0200 Subject: [PATCH] packet: Use C99 initializer to reset session->in_packet Signed-off-by: Andreas Schneider Reviewed-by: Jakub Jelen --- src/packet.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/packet.c b/src/packet.c index ae258381..aa2f17f0 100644 --- a/src/packet.c +++ b/src/packet.c @@ -199,7 +199,9 @@ int ssh_packet_socket_callback(const void *data, size_t receivedlen, void *user) return 0; } - memset(&session->in_packet, 0, sizeof(PACKET)); + session->in_packet = (struct packet_struct) { + .type = 0, + }; if (session->in_buffer) { rc = ssh_buffer_reinit(session->in_buffer); @@ -515,9 +517,11 @@ SSH_PACKET_CALLBACK(ssh_packet_unimplemented){ /** @internal * @parse the "Type" header field of a packet and updates the session */ -int ssh_packet_parse_type(ssh_session session) +int ssh_packet_parse_type(struct ssh_session_struct *session) { - memset(&session->in_packet, 0, sizeof(PACKET)); + session->in_packet = (struct packet_struct) { + .type = 0, + }; if (session->in_buffer == NULL) { return SSH_ERROR;