diff options
author | asomers <asomers@FreeBSD.org> | 2017-05-30 15:18:22 +0000 |
---|---|---|
committer | asomers <asomers@FreeBSD.org> | 2017-05-30 15:18:22 +0000 |
commit | de397ab94c0ae9b023ad4c6e02e762c52aaa9dc0 (patch) | |
tree | 4f69bf660d0d3e9fccd2e6fc9a705211204cad85 /usr.bin | |
parent | b9f957f3c6e4edf122f9327c5c610792ab2fbf19 (diff) | |
download | FreeBSD-src-de397ab94c0ae9b023ad4c6e02e762c52aaa9dc0.zip FreeBSD-src-de397ab94c0ae9b023ad4c6e02e762c52aaa9dc0.tar.gz |
MFC r318141, r318143-r318144
r318141:
strcpy => strlcpy
Reported by: Coverity
CID: 1352771
Sponsored by: Spectra Logic Corp
r318143:
strcpy => strlcpy
Reported by: Coverity
CID: 1006715
Sponsored by: Spectra Logic Corp
r318144:
Don't depend on assert(3) getting evaluated
Reported by: imp
X-MFC-With: 318141, 318143
Sponsored by: Spectra Logic Corp
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/mkuzip/mkuzip.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.bin/mkuzip/mkuzip.c b/usr.bin/mkuzip/mkuzip.c index 6288f4e..1a78ae2 100644 --- a/usr.bin/mkuzip/mkuzip.c +++ b/usr.bin/mkuzip/mkuzip.c @@ -108,7 +108,7 @@ int main(int argc, char **argv) struct mkuz_conveyor *cvp; void *c_ctx; struct mkuz_blk_info *chit; - size_t ncpusz, ncpu; + size_t ncpusz, ncpu, magiclen; double st, et; st = getdtime(); @@ -192,7 +192,8 @@ int main(int argc, char **argv) /* Not reached */ } - strcpy(hdr.magic, cfs.handler->magic); + magiclen = strlcpy(hdr.magic, cfs.handler->magic, sizeof(hdr.magic)); + assert(magiclen < sizeof(hdr.magic)); if (cfs.en_dedup != 0) { hdr.magic[CLOOP_OFS_VERSN] = CLOOP_MAJVER_3; |