From acd4a98cd5eddb7b9f09608d2973d6670fdfcb5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A3=B0=E7=BA=B3?= <1595220980@qq.com> Date: Thu, 26 Jun 2025 10:08:02 +0800 Subject: [PATCH] Modify buffer size to prevent overflow --- rigs/guohetec/pmr171.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/rigs/guohetec/pmr171.c b/rigs/guohetec/pmr171.c index c4baac155..b876ed989 100644 --- a/rigs/guohetec/pmr171.c +++ b/rigs/guohetec/pmr171.c @@ -400,7 +400,7 @@ static int pmr171_open(RIG *rig) cmd[7] = crc & 0xFF; // Receive buffer (complete response packet should be 33 bytes) - unsigned char reply[33]; + unsigned char reply[40]; int ret = pmr171_send(rig, cmd, sizeof(cmd), reply, sizeof(reply)); if (ret != RIG_OK) { rig_debug(RIG_DEBUG_ERR, "%s: Communication failure, error code=%d\n", __func__, ret); @@ -473,7 +473,7 @@ static int pmr171_open(RIG *rig) struct rig_cache *cachep = CACHE(rig); hamlib_port_t *rp = RIGPORT(rig); pmr171_data_t *p = (pmr171_data_t *) STATE(rig)->priv; - unsigned char reply[33]; + unsigned char reply[40]; // Get latest status from hardware pmr171_send_cmd1(rig, 0x0b, 0); @@ -524,7 +524,7 @@ static int pmr171_open(RIG *rig) static int pmr171_get_vfo(RIG *rig, vfo_t *vfo) { hamlib_port_t *rp = RIGPORT(rig); - unsigned char reply[33]; + unsigned char reply[40]; // Send status sync command to get current VFO state pmr171_send_cmd1(rig, 0x0b, 0); @@ -562,7 +562,7 @@ static int pmr171_open(RIG *rig) { struct rig_cache *cachep = CACHE(rig); hamlib_port_t *rp = RIGPORT(rig); - unsigned char reply[33]; + unsigned char reply[40]; pmr171_send_cmd1(rig, 0x0b, 0); @@ -627,7 +627,7 @@ static int pmr171_open(RIG *rig) static int pmr171_send_cmd2(RIG *rig, unsigned char cmd, unsigned char value, int response) { - unsigned char reply[33]; + unsigned char reply[40]; hamlib_port_t *rp = RIGPORT(rig); rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__); unsigned char buf[64] = { 0xa5, 0xa5, 0xa5, 0xa5, 0x04, 0x00, 0x00, 0x00, 0x00 };