Change sprintf to snprint in celestron.c

https://github.com/Hamlib/Hamlib/issues/857
pull/928/head
Mike Black W9MDB 2022-01-09 11:51:48 -06:00
rodzic 4adcda259a
commit bf4afbcaa1
1 zmienionych plików z 4 dodań i 4 usunięć

Wyświetl plik

@ -136,7 +136,7 @@ celestron_set_position(ROT *rot, azimuth_t az, elevation_t el)
tube is perpendicular to the azimuth axis. tube is perpendicular to the azimuth axis.
*/ */
sprintf(cmdstr, "B%04X,%04X", snprintf(cmdstr, sizeof(cmdstr), "B%04X,%04X",
(unsigned)((az / 360.) * 65535), (unsigned)((az / 360.) * 65535),
(unsigned)((el / 360.) * 65535)); (unsigned)((el / 360.) * 65535));
@ -198,7 +198,7 @@ celestron_stop(ROT *rot)
static const char * static const char *
celestron_get_info(ROT *rot) celestron_get_info(ROT *rot)
{ {
static char info[16]; static char info[32];
char str[8]; char str[8];
rig_debug(RIG_DEBUG_TRACE, "%s called\n", __func__); rig_debug(RIG_DEBUG_TRACE, "%s called\n", __func__);
@ -208,7 +208,7 @@ celestron_get_info(ROT *rot)
return NULL; return NULL;
} }
sprintf(info, "V%c.%c", str[0], str[1]); snprintf(info, sizeof(info), "V%c.%c", str[0], str[1]);
return info; return info;
} }
@ -231,7 +231,7 @@ const struct rot_caps nexstar_rot_caps =
ROT_MODEL(ROT_MODEL_NEXSTAR), ROT_MODEL(ROT_MODEL_NEXSTAR),
.model_name = "NexStar", // Any Celestron starting with version 1.2 .model_name = "NexStar", // Any Celestron starting with version 1.2
.mfg_name = "Celestron", .mfg_name = "Celestron",
.version = "20110821.0", .version = "20220109.0",
.copyright = "LGPL", .copyright = "LGPL",
.status = RIG_STATUS_UNTESTED, .status = RIG_STATUS_UNTESTED,
.rot_type = ROT_TYPE_AZEL, .rot_type = ROT_TYPE_AZEL,