Fix gp2000_get_mode bogus sscanf -- potential seg fault function would not work

pull/788/head
Mike Black W9MDB 2021-09-01 09:06:23 -05:00
rodzic ee56688003
commit 3e3436bdce
2 zmienionych plików z 5 dodań i 2 usunięć

Wyświetl plik

@ -237,7 +237,7 @@ gp2000_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
int buf_len, retval;
int nmode;
char *pmode = "UNKNOWN";
int n = sscanf(buf, "%*cI%d", &nmode);
int n;
rig_debug(RIG_DEBUG_VERBOSE, "%s: vfo=%s\n", __func__, rig_strvfo(vfo));
@ -252,8 +252,11 @@ gp2000_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
return retval;
}
n = sscanf(buf, "%*cI%d", &nmode);
if (n != 1)
{
rig_debug(RIG_DEBUG_ERR, "%s: unable to parse mode from '%s'\n", __func__, buf);
return -RIG_EPROTO;
}

Wyświetl plik

@ -25,7 +25,7 @@
#define _XK2000_H 1
#undef BACKEND_VER
#define BACKEND_VER "20180307"
#define BACKEND_VER "20210901"
#include <hamlib/rig.h>