diff options
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)); } } } |