Quell gcc 8.2.0 warning of possible truncation

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...
pull/58/head^2
Nate Bargmann 2018-10-25 16:36:41 -05:00
rodzic a3ea2864a7
commit 2d7d3d21df
1 zmienionych plików z 2 dodań i 2 usunięć

Wyświetl plik

@ -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)))