summaryrefslogtreecommitdiffstats
path: root/usr.bin/tftp/main.c
diff options
context:
space:
mode:
authordelphij <delphij@FreeBSD.org>2008-10-13 22:50:38 +0000
committerdelphij <delphij@FreeBSD.org>2008-10-13 22:50:38 +0000
commitce7f7a73232b004b6416dd155580ae02f3091bdf (patch)
treea7ab47525cffdedc4d786d7e72c686117e018dc3 /usr.bin/tftp/main.c
parentead773b051a53f42e87af702e86dcd261d2821f7 (diff)
downloadFreeBSD-src-ce7f7a73232b004b6416dd155580ae02f3091bdf.zip
FreeBSD-src-ce7f7a73232b004b6416dd155580ae02f3091bdf.tar.gz
Use strlcpy() instead of strncpy() when we want the string to be
NUL-terminated.
Diffstat (limited to 'usr.bin/tftp/main.c')
-rw-r--r--usr.bin/tftp/main.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/usr.bin/tftp/main.c b/usr.bin/tftp/main.c
index 591914c..c41d519 100644
--- a/usr.bin/tftp/main.c
+++ b/usr.bin/tftp/main.c
@@ -233,11 +233,10 @@ setpeer0(host, port)
/* res->ai_addr <= sizeof(peeraddr) is guaranteed */
memcpy(&peeraddr, res->ai_addr, res->ai_addrlen);
if (res->ai_canonname) {
- (void) strncpy(hostname, res->ai_canonname,
+ (void) strlcpy(hostname, res->ai_canonname,
sizeof(hostname));
} else
- (void) strncpy(hostname, host, sizeof(hostname));
- hostname[sizeof(hostname)-1] = 0;
+ (void) strlcpy(hostname, host, sizeof(hostname));
connected = 1;
}
OpenPOWER on IntegriCloud