diff options
author | delphij <delphij@FreeBSD.org> | 2015-07-15 19:21:26 +0000 |
---|---|---|
committer | delphij <delphij@FreeBSD.org> | 2015-07-15 19:21:26 +0000 |
commit | 2a25cee78ab1d37e7d2bc40ae675646974d99f56 (patch) | |
tree | b0302ac4be59e104f4e1e54014561a1389397192 /contrib/ntp/libntp/findconfig.c | |
parent | a0741a75537b2e0514472ac3b28afc55a7846c30 (diff) | |
download | FreeBSD-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/libntp/findconfig.c')
-rw-r--r-- | contrib/ntp/libntp/findconfig.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/contrib/ntp/libntp/findconfig.c b/contrib/ntp/libntp/findconfig.c index ecf6a4b..1785ff7 100644 --- a/contrib/ntp/libntp/findconfig.c +++ b/contrib/ntp/libntp/findconfig.c @@ -22,13 +22,13 @@ FindConfig( struct utsname unamebuf; /* All keyed by initial target being a directory */ - (void) strcpy(result, base); + strlcpy(result, base, sizeof(result)); if (stat(result, &sbuf) == 0) { if (S_ISDIR(sbuf.st_mode)) { /* First choice is my hostname */ if (gethostname(hostname, BUFSIZ) >= 0) { - (void) sprintf(result, "%s/%s", base, hostname); + snprintf(result, sizeof(result), "%s/%s", base, hostname); if (stat(result, &sbuf) == 0) { goto outahere; } else { @@ -39,17 +39,19 @@ FindConfig( cp = unamebuf.machine + 5; else cp = unamebuf.machine; - (void) sprintf(result, "%s/default.%s", base, cp); + snprintf(result, sizeof(result), "%s/default.%s", base, cp); if (stat(result, &sbuf) == 0) { goto outahere; } else { /* Last choice is just default */ - (void) sprintf(result, "%s/default", base); + snprintf(result, sizeof(result), "%s/default", base); if (stat(result, &sbuf) == 0) { goto outahere; } else { - (void) strcpy(result, "/not/found"); + strlcpy(result, + "/not/found", + sizeof(result)); } } } |