From 374f9b1db2e49e8524c8322895fb4f20ab0a6388 Mon Sep 17 00:00:00 2001 From: Aaron Lipinski Date: Sat, 10 Aug 2019 08:52:53 +1200 Subject: [PATCH] avoid stack use after scope --- ui/cmdpipe.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ui/cmdpipe.c b/ui/cmdpipe.c index 3581086..2119516 100644 --- a/ui/cmdpipe.c +++ b/ui/cmdpipe.c @@ -73,9 +73,9 @@ int send_synchronous_command( struct mtr_ctl *ctl, struct packet_command_pipe_t *cmdpipe, const char *cmd, - struct command_t *result) + struct command_t *result, + char *reply) { - char reply[PACKET_REPLY_BUFFER_SIZE]; int command_length; int write_length; int read_length; @@ -120,11 +120,12 @@ int check_feature( { char check_command[COMMAND_BUFFER_SIZE]; struct command_t reply; + char reply_buf[PACKET_REPLY_BUFFER_SIZE]; snprintf(check_command, COMMAND_BUFFER_SIZE, "1 check-support feature %s\n", feature); - if (send_synchronous_command(ctl, cmdpipe, check_command, &reply) == + if (send_synchronous_command(ctl, cmdpipe, check_command, &reply, reply_buf) == -1) { return -1; } -- 2.47.2