summaryrefslogtreecommitdiffstats
path: root/usr.bin/hexdump
diff options
context:
space:
mode:
authordelphij <delphij@FreeBSD.org>2009-06-23 23:32:24 +0000
committerdelphij <delphij@FreeBSD.org>2009-06-23 23:32:24 +0000
commit08ae7d200efa5ab9e869687d34f8a484ab92a756 (patch)
treecc63c152e4d648b520982dfea92857f4214c7e5b /usr.bin/hexdump
parenteed25972d10fcfaa1d046f1f4ff2d2e047bcf360 (diff)
downloadFreeBSD-src-08ae7d200efa5ab9e869687d34f8a484ab92a756.zip
FreeBSD-src-08ae7d200efa5ab9e869687d34f8a484ab92a756.tar.gz
Use strlcpy() instead of explicitly set \0 on the tail of the array.
Diffstat (limited to 'usr.bin/hexdump')
-rw-r--r--usr.bin/hexdump/parse.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/usr.bin/hexdump/parse.c b/usr.bin/hexdump/parse.c
index ef19278..07ad63d 100644
--- a/usr.bin/hexdump/parse.c
+++ b/usr.bin/hexdump/parse.c
@@ -142,8 +142,7 @@ add(const char *fmt)
badfmt(fmt);
if (!(tfu->fmt = malloc(p - savep + 1)))
err(1, NULL);
- (void) strncpy(tfu->fmt, savep, p - savep);
- tfu->fmt[p - savep] = '\0';
+ (void) strlcpy(tfu->fmt, savep, p - savep + 1);
escape(tfu->fmt);
p++;
}
OpenPOWER on IntegriCloud