diff --git a/rigs/alinco/dxsr8.c b/rigs/alinco/dxsr8.c index ceda53d4c..e4d5a56fc 100644 --- a/rigs/alinco/dxsr8.c +++ b/rigs/alinco/dxsr8.c @@ -471,6 +471,7 @@ int dxsr8_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) return -RIG_EINVAL; } + filter=0; // avoid compiler warings of being possibly uninitialized retval = dxsr8_read_num(rig, AL "~RR_NAR" EOM, &filter); if (filter == 0) diff --git a/rigs/aor/aor.c b/rigs/aor/aor.c index 38430d366..61c3cd253 100644 --- a/rigs/aor/aor.c +++ b/rigs/aor/aor.c @@ -467,6 +467,7 @@ int aor_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) if (retval != RIG_OK) { return retval; } strncpy(mdbuf2, mdbuf + 4, 3); /* Extract first 'BW' part */ + mdbuf2[3]='\0'; // in case strnpy produces and un-terminated string mdbuf2_len = strlen(mdbuf2); retval = aor_transaction(rig, mdbuf2, mdbuf2_len, NULL, NULL); diff --git a/rigs/drake/drake.c b/rigs/drake/drake.c index 06687252d..d3159d918 100644 --- a/rigs/drake/drake.c +++ b/rigs/drake/drake.c @@ -563,6 +563,7 @@ int drake_set_mem(RIG *rig, vfo_t vfo, int ch) len = sprintf(buf, "C%03d" EOM, ch); + ack_len=0; // fix compile-time warning "possibly uninitialized" retval = drake_transaction(rig, buf, len, ackbuf, &ack_len); if (ack_len != 2) @@ -852,6 +853,7 @@ int drake_get_chan(RIG *rig, channel_t *chan, int read_only) strncpy(chan->channel_desc, mdbuf + 25, 7); + chan->channel_desc[8]='\0'; // in case strncpy did not terminate the string //now put the radio back the way it was //we apparently can't do a read-only channel read diff --git a/rigs/kenwood/kenwood.c b/rigs/kenwood/kenwood.c index 196826e55..1c85a2249 100644 --- a/rigs/kenwood/kenwood.c +++ b/rigs/kenwood/kenwood.c @@ -1661,7 +1661,7 @@ int kenwood_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) int kenwood_get_rit(RIG *rig, vfo_t vfo, shortfreq_t *rit) { int retval; - char buf[6]; + char buf[7]; struct kenwood_priv_data *priv = rig->state.priv; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); @@ -1710,8 +1710,8 @@ int kenwood_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit) if (priv->has_rit2) // if backend shows it has the Set 2 command { - char cmd[10]; - snprintf(cmd, sizeof(cmd) - 1, "R%c%05d", rit > 0 ? 'U' : 'D', abs((int)rit)); + char cmd[15]; + snprintf(cmd, sizeof(cmd)-1, "R%c%05d", rit > 0 ? 'U' : 'D', abs((int)rit)); retval = kenwood_transaction(rig, cmd, NULL, 0); } else diff --git a/src/rig.c b/src/rig.c index 274d1a655..be6dcefdf 100644 --- a/src/rig.c +++ b/src/rig.c @@ -182,8 +182,7 @@ static const char *rigerror_table[] = "Communication bus collision", "NULL RIG handle or invalid pointer parameter", "Invalid VFO", - "Argument out of domain of func", - NULL, + "Argument out of domain of func" }; @@ -294,7 +293,8 @@ const char *HAMLIB_API rigerror(int errnum) if (errnum >= ERROR_TBL_SZ) { - return NULL; + // This should not happen, but if it happens don't return NULL + return "ERR_OUT_OF_RANGE"; } return rigerror_table[errnum];