From 2d7d3d21df5d2ae2113a588032d260c3ba51981f Mon Sep 17 00:00:00 2001 From: Nate Bargmann Date: Thu, 25 Oct 2018 16:36:41 -0500 Subject: [PATCH] Quell gcc 8.2.0 warning of possible truncation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On Debian Buster gcc ((Debian 8.2.0-8) 8.2.0) was throwing the following warning: CC ft991.lo ../../hamlib/yaesu/ft991.c: In function ‘ft991_set_split_mode’: ../../hamlib/yaesu/ft991.c:336:5: warning: ‘strncat’ output may be truncated copying 128 bytes from a string of length 128 [-Wstringop-truncation] strncat (restore_commands, priv->ret_data, NEWCAT_DATA_LEN-1); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ At least now the warning is gone... --- yaesu/ft991.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/yaesu/ft991.c b/yaesu/ft991.c index deaebbb22..7b052df22 100644 --- a/yaesu/ft991.c +++ b/yaesu/ft991.c @@ -289,7 +289,7 @@ int ft991_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode, pbwidth_t *tx_wi * ------------------------------------------------------------------ * Returns RIG_OK on success or an error code on failure * - * Comments: Passs band is not set here nor does it make sense as the + * Comments: Pass band is not set here nor does it make sense as the * FT991 cannot receive on VFO B. The FT991 cannot set * VFO B mode directly so we'll just set A and swap A * into B but we must preserve the VFO A mode and VFO B @@ -333,7 +333,7 @@ int ft991_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode, pbwidth_t tx_widt { return err; } - strncat (restore_commands, priv->ret_data, NEWCAT_DATA_LEN-1); + strncpy(restore_commands, priv->ret_data, NEWCAT_DATA_LEN); /* Change mode on VFOA */ if (RIG_OK != (err = newcat_set_mode (rig, RIG_VFO_A, tx_mode, RIG_PASSBAND_NOCHANGE)))