From a5805bde83c887c0c2000ae55a7bf61b9150fbc7 Mon Sep 17 00:00:00 2001
From: Ramakrishnan Muthukrishnan <ram@rkrishnan.org>
Date: Wed, 12 Jan 2022 12:37:03 +0530
Subject: [PATCH] small fixes in audio gain

---
 rigctl.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/rigctl.c b/rigctl.c
index c2b7812..7c61622 100644
--- a/rigctl.c
+++ b/rigctl.c
@@ -953,11 +953,12 @@ gboolean parse_extended_cmd(char *command, CLIENT *client) {
       // read/set audio gain
       if (command[4] == ';') {
         // send reply back
+        memset(reply, '\0', 9);
         sprintf(reply, "ZZAG%03d;", (int)(active_receiver->volume * 100.0));
         send_resp(client->fd, reply);
       } else if (command[7] == ';') {
           command[7] = '\0';
-          int gain = atoi(&command[4]);
+          int gain = strtol(&command[4], NULL, 10);
           active_receiver->volume = (double)gain / 100.0;
           update_af_gain();
       }
-- 
2.45.2