diff options
author | delphij <delphij@FreeBSD.org> | 2015-10-06 22:49:25 +0000 |
---|---|---|
committer | delphij <delphij@FreeBSD.org> | 2015-10-06 22:49:25 +0000 |
commit | 1ce120cf1a253d6da6be3dab4ffe5ce99e6d03f1 (patch) | |
tree | 0ac257d3da130465effcb3418a62cf50fb86cef0 /usr.sbin/watch | |
parent | a881a53a21e747ecd0f212544050d00b8ff78018 (diff) | |
download | FreeBSD-src-1ce120cf1a253d6da6be3dab4ffe5ce99e6d03f1.zip FreeBSD-src-1ce120cf1a253d6da6be3dab4ffe5ce99e6d03f1.tar.gz |
Use strlcpy() when the string is expected to be nul-terminated.
MFC after: 2 weeks
Diffstat (limited to 'usr.sbin/watch')
-rw-r--r-- | usr.sbin/watch/watch.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.sbin/watch/watch.c b/usr.sbin/watch/watch.c index eecf0d3..766d45a 100644 --- a/usr.sbin/watch/watch.c +++ b/usr.sbin/watch/watch.c @@ -247,7 +247,7 @@ set_dev(const char *name) if ((sb.st_mode & S_IFMT) != S_IFCHR) fatal(EX_DATAERR, "must be a character device"); - strncpy(dev_name, buf, DEV_NAME_LEN); + strlcpy(dev_name, buf, sizeof(dev_name)); attach_snp(); } @@ -340,7 +340,7 @@ main(int ac, char *av[]) else fatal(EX_DATAERR, "no device name given"); } else - strncpy(dev_name, *av, DEV_NAME_LEN); + strlcpy(dev_name, *av, sizeof(dev_name)); set_dev(dev_name); |