diff options
author | Jakob Schlyter <jakob@cvs.openbsd.org> | 2003-04-23 06:56:13 +0000 |
---|---|---|
committer | Jakob Schlyter <jakob@cvs.openbsd.org> | 2003-04-23 06:56:13 +0000 |
commit | 875815938bf44f678d42176d396cf2dcf6981f2c (patch) | |
tree | 6c7de6a4db805165c7932257024b06b458e195ac /usr.sbin/bind/bin/named/unix | |
parent | 5bd65e491cdcb6238a2b4d8d63f0e648a36e6ebf (diff) |
more snprintf and strlcpy/strlcat fixes. from todd@ and tedu@.
Diffstat (limited to 'usr.sbin/bind/bin/named/unix')
-rw-r--r-- | usr.sbin/bind/bin/named/unix/os.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/usr.sbin/bind/bin/named/unix/os.c b/usr.sbin/bind/bin/named/unix/os.c index e94088699f4..8f610ccf1f3 100644 --- a/usr.sbin/bind/bin/named/unix/os.c +++ b/usr.sbin/bind/bin/named/unix/os.c @@ -495,15 +495,14 @@ open_pidfile(const char *filename, isc_boolean_t first_time) { cleanup_pidfile(); - len = strlen(filename); - pidfile = malloc(len + 1); + len = strlen(filename) + 1; + pidfile = malloc(len); if (pidfile == NULL) { isc__strerror(errno, strbuf, sizeof(strbuf)); (*report)("couldn't malloc '%s': %s", filename, strbuf); return -1; } - /* This is safe. */ - strcpy(pidfile, filename); + strlcpy(pidfile, filename, len); fd = safe_open(filename, ISC_FALSE); if (fd < 0) { |