Change sprintf to snprint in wj.c

https://github.com/Hamlib/Hamlib/issues/857
pull/928/head
Mike Black W9MDB 2022-01-10 23:30:58 -06:00
rodzic 8372bba7f4
commit d6e33fd562
1 zmienionych plików z 7 dodań i 2 usunięć

Wyświetl plik

@ -283,14 +283,14 @@ int wj_set_conf(RIG *rig, token_t token, const char *val)
* Assumes rig!=NULL, rig->state.priv!=NULL
* and val points to a buffer big enough to hold the conf value.
*/
int wj_get_conf(RIG *rig, token_t token, char *val)
int wj_get_conf2(RIG *rig, token_t token, char *val, int val_len)
{
struct wj_priv_data *priv = (struct wj_priv_data *)rig->state.priv;
switch (token)
{
case TOK_RIGID:
sprintf(val, "%u", priv->receiver_id);
SNPRINTF(val, val_len, "%u", priv->receiver_id);
break;
default:
@ -300,6 +300,11 @@ int wj_get_conf(RIG *rig, token_t token, char *val)
return RIG_OK;
}
int wj_get_conf(RIG *rig, token_t token, char *val)
{
return wj_get_conf2(rig, token, val, 128);
}
/*
* wj_set_freq
* Assumes rig!=NULL