summaryrefslogtreecommitdiffstats
path: root/contrib/ntp/util/tg.c
diff options
context:
space:
mode:
authordelphij <delphij@FreeBSD.org>2015-07-15 19:21:26 +0000
committerdelphij <delphij@FreeBSD.org>2015-07-15 19:21:26 +0000
commit2a25cee78ab1d37e7d2bc40ae675646974d99f56 (patch)
treeb0302ac4be59e104f4e1e54014561a1389397192 /contrib/ntp/util/tg.c
parenta0741a75537b2e0514472ac3b28afc55a7846c30 (diff)
downloadFreeBSD-src-2a25cee78ab1d37e7d2bc40ae675646974d99f56.zip
FreeBSD-src-2a25cee78ab1d37e7d2bc40ae675646974d99f56.tar.gz
MFC r280849,280915-280916,281015-281016,282097,282408,282415,283542,
284864,285169-285170,285435: ntp 4.2.8p3. Relnotes: yes Approved by: re (?)
Diffstat (limited to 'contrib/ntp/util/tg.c')
-rw-r--r--contrib/ntp/util/tg.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/contrib/ntp/util/tg.c b/contrib/ntp/util/tg.c
index aa3950d..8a96a81 100644
--- a/contrib/ntp/util/tg.c
+++ b/contrib/ntp/util/tg.c
@@ -266,13 +266,13 @@ main(
/*
* Parse options
*/
- strcpy(device, DEVICE);
+ strlcpy(device, DEVICE, sizeof(device));
year = 0;
while ((temp = getopt(argc, argv, "a:dhilsu:v:y:")) != -1) {
switch (temp) {
case 'a': /* specify audio device (/dev/audio) */
- strcpy(device, optarg);
+ strlcpy(device, optarg, sizeof(device));
break;
case 'd': /* set DST for summer (WWV/H only) */
@@ -374,8 +374,8 @@ main(
case WWV:
printf("year %d day %d time %02d:%02d:%02d tone %d\n",
year, day, hour, minute, second, tone);
- sprintf(code, "%01d%03d%02d%02d%01d", year / 10, day,
- hour, minute, year % 10);
+ snprintf(code, sizeof(code), "%01d%03d%02d%02d%01d",
+ year / 10, day, hour, minute, year % 10);
printf("%s\n", code);
ptr = 8;
for (i = 0; i <= second; i++) {
@@ -431,16 +431,17 @@ main(
year++;
}
if (encode == WWV) {
- sprintf(code, "%01d%03d%02d%02d%01d",
- year / 10, day, hour, minute, year %
- 10);
+ snprintf(code, sizeof(code),
+ "%01d%03d%02d%02d%01d", year / 10,
+ day, hour, minute, year % 10);
printf("\n%s\n", code);
ptr = 8;
}
}
if (encode == IRIG) {
- sprintf(code, "%04x%04d%06d%02d%02d%02d", 0,
- year, day, hour, minute, second);
+ snprintf(code, sizeof(code),
+ "%04x%04d%06d%02d%02d%02d", 0, year, day,
+ hour, minute, second);
printf("%s\n", code);
ptr = 19;
}
OpenPOWER on IntegriCloud