From: Ramakrishnan Muthukrishnan <ram@rkrishnan.org>
Date: Wed, 12 Jan 2022 06:14:36 +0000 (+0530)
Subject: send_reply() relies on strlen() to get the bytes to send, so terminate properly
X-Git-Url: https://git.rkrishnan.org/%5B/%5D%20/file/frontends/using.html?a=commitdiff_plain;h=e9514f065380123e58c5ea37080f158b36d23154;p=pihpsdr.git

send_reply() relies on strlen() to get the bytes to send, so terminate properly
---

diff --git a/rigctl.c b/rigctl.c
index fc5c66b..0ff553b 100644
--- a/rigctl.c
+++ b/rigctl.c
@@ -1819,6 +1819,7 @@ gboolean parse_extended_cmd(char *command, CLIENT *client) {
     case 'G': // ZZMG
         // set/read mic gain
         if (command[4] == ';') {
+            memset(reply, \0, 9);
             sprintf(reply, "ZZMG%03d;", (int)(((mic_gain + 12.0) / 72.0) * 100.0));
             send_resp(client->fd, reply);
         } else if (command[7] == ';') {