From cc6cce3ea05c7196dbc603275f5204004bd27088 Mon Sep 17 00:00:00 2001 From: Ramakrishnan Muthukrishnan Date: Tue, 4 Jan 2022 17:54:42 +0530 Subject: [PATCH] bug fix: atoi() without properly terminating the string --- rigctl.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/rigctl.c b/rigctl.c index 1fbf91f..85b9c12 100644 --- a/rigctl.c +++ b/rigctl.c @@ -955,9 +955,10 @@ gboolean parse_extended_cmd(char *command, CLIENT *client) { sprintf(reply, "ZZAG%03d;", (int)(active_receiver->volume * 100.0)); send_resp(client->fd, reply); } else { - int gain = atoi(&command[4]); - active_receiver->volume = (double)gain / 100.0; - update_af_gain(); + command[7] = '\0'; + int gain = atoi(&command[4]); + active_receiver->volume = (double)gain / 100.0; + update_af_gain(); } break; case 'I': // ZZAI -- 2.45.2