]> git.rkrishnan.org Git - pihpsdr.git/commitdiff
bug fix: atoi() without properly terminating the string
authorRamakrishnan Muthukrishnan <ram@rkrishnan.org>
Tue, 4 Jan 2022 12:24:42 +0000 (17:54 +0530)
committerRamakrishnan Muthukrishnan <ram@rkrishnan.org>
Tue, 4 Jan 2022 12:24:42 +0000 (17:54 +0530)
rigctl.c

index 1fbf91f7e142e6b7d54c267de0f28f53c3ed9ea3..85b9c12262d1aae4955b8c714d6be92aa43fd471 100644 (file)
--- 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