diff --git a/rigs/alinco/dxsr8.c b/rigs/alinco/dxsr8.c index 3ac501345..86eae83eb 100644 --- a/rigs/alinco/dxsr8.c +++ b/rigs/alinco/dxsr8.c @@ -346,6 +346,7 @@ int dxsr8_set_freq(RIG *rig, vfo_t vfo, freq_t freq) return -RIG_EINVAL; } + // cppcheck-suppress * cmd_len = sprintf(cmd, AL "~RW_RXF%08"PRIll EOM, (int64_t)freq); return dxsr8_transaction(rig, cmd, cmd_len, NULL, NULL); } @@ -769,4 +770,4 @@ int dxsr8_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt) cmd_len = sprintf(cmd, AL "~RW_PTT%02d" EOM, ptt); return dxsr8_transaction(rig, cmd, cmd_len, NULL, NULL); -} \ No newline at end of file +} diff --git a/src/misc.c b/src/misc.c index f177f783a..21bca2e5c 100644 --- a/src/misc.c +++ b/src/misc.c @@ -1385,7 +1385,7 @@ int HAMLIB_API parse_hoststr(char *hoststr, char host[256], char port[6]) dummy[0] = 0; // bracketed IPV6 with optional port - int n = sscanf(hoststr, "[%255[^]]]:%s", host, port); + int n = sscanf(hoststr, "[%255[^]]]:%5s", host, port); if (n >= 1) { @@ -1393,7 +1393,7 @@ int HAMLIB_API parse_hoststr(char *hoststr, char host[256], char port[6]) } // non-bracketed IPV6 with optional link addr - n = sscanf(hoststr, "%x::%x:%x:%x:%x:%%%31[^:]:%s", &net1, &net2, &net3, + n = sscanf(hoststr, "%x::%x:%x:%x:%x:%%%31[^:]:%5s", &net1, &net2, &net3, &net4, &net5, link, port); if (strchr(hoststr, '%') && (n == 5 || n == 6)) @@ -1433,7 +1433,7 @@ int HAMLIB_API parse_hoststr(char *hoststr, char host[256], char port[6]) // bracketed localhost if (strstr(hoststr, "::1")) { - n = sscanf(hoststr, "::1%s", dummy); + n = sscanf(hoststr, "::1%5s", dummy); strcpy(host, hoststr); if (n == 1) diff --git a/src/network.c b/src/network.c index b4ed224c3..efe3952cc 100644 --- a/src/network.c +++ b/src/network.c @@ -130,7 +130,7 @@ int network_open(hamlib_port_t *rp, int default_port) int status; struct addrinfo hints, *res, *saved_res; struct in6_addr serveraddr; - char hoststr[256], portstr[6]; + char hoststr[256], portstr[6] = ""; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); rig_debug(RIG_DEBUG_VERBOSE, "%s version 1.0\n", __func__); diff --git a/src/rig.c b/src/rig.c index e5ab5ee8b..8ff9ca2ad 100644 --- a/src/rig.c +++ b/src/rig.c @@ -558,7 +558,6 @@ int HAMLIB_API rig_open(RIG *rig) value_t parm_value; //unsigned int net1, net2, net3, net4, net5, net6, net7, net8, port; int is_network = 0; - char hoststr[256], portstr[6]; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); @@ -572,6 +571,7 @@ int HAMLIB_API rig_open(RIG *rig) if (strlen(rs->rigport.pathname) > 0) { + char hoststr[256], portstr[6]; status = parse_hoststr(rs->rigport.pathname, hoststr, portstr); if (status == RIG_OK) { is_network = 1; } @@ -2911,14 +2911,14 @@ int HAMLIB_API rig_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq) int retcode, rc2; vfo_t curr_vfo, tx_vfo; - rig_debug(RIG_DEBUG_VERBOSE, "%s called vfo=%s, curr_vfo=%s\n", __func__, - rig_strvfo(vfo), rig_strvfo(rig->state.current_vfo)); - if (CHECK_RIG_ARG(rig)) { return -RIG_EINVAL; } + rig_debug(RIG_DEBUG_VERBOSE, "%s called vfo=%s, curr_vfo=%s\n", __func__, + rig_strvfo(vfo), rig_strvfo(rig->state.current_vfo)); + caps = rig->caps; if (caps->set_split_freq diff --git a/tests/rigctl_parse.c b/tests/rigctl_parse.c index d89985aa8..3c9befc9a 100644 --- a/tests/rigctl_parse.c +++ b/tests/rigctl_parse.c @@ -1957,6 +1957,7 @@ declare_proto_rig(get_freq) { int status; freq_t freq; + // cppcheck-suppress * char *fmt = "%"PRIll"%c"; status = rig_get_freq(rig, vfo, &freq); diff --git a/tests/rigctlcom.c b/tests/rigctlcom.c index a2b63ec8f..e3f3f9f31 100644 --- a/tests/rigctlcom.c +++ b/tests/rigctlcom.c @@ -737,8 +737,8 @@ static int handle_ts2000(void *arg) int p15 = 0; // P15 Shift status dummy value for now int retval = rig_get_freq(my_rig, RIG_VFO_A, &freq); char response[64]; - // cppcheck-suppress * char *fmt = + // cppcheck-suppress * "IF%011"PRIll"%04d+%05d%1d%1d%1d%02d%1d%1"PRIll"%1d%1d%1d%1d%02d%1d;"; if (retval != RIG_OK) diff --git a/tests/rigctld.c b/tests/rigctld.c index 144f6ad65..f6a6d0cb9 100644 --- a/tests/rigctld.c +++ b/tests/rigctld.c @@ -685,8 +685,7 @@ int main(int argc, char *argv[]) memset(&hints, 0, sizeof(struct addrinfo)); hints.ai_family = AF_UNSPEC; /* Allow IPv4 or IPv6 */ hints.ai_socktype = SOCK_STREAM;/* TCP socket */ - hints.ai_flags = AI_PASSIVE; /* For wildcard IP address */ - hints.ai_flags = AI_CANONNAME; + hints.ai_flags = AI_PASSIVE | AI_CANONNAME; /* For wildcard IP address */ hints.ai_protocol = 0; /* Any protocol */ retcode = getaddrinfo(src_addr, portno, &hints, &result);