From: Ramakrishnan Muthukrishnan Date: Tue, 4 Jan 2022 12:24:42 +0000 (+0530) Subject: bug fix: atoi() without properly terminating the string X-Git-Url: https://git.rkrishnan.org/Site/Content/simplejson/status?a=commitdiff_plain;h=cc6cce3ea05c7196dbc603275f5204004bd27088;p=pihpsdr.git bug fix: atoi() without properly terminating the string --- 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