diff options
author | Ted Unangst <tedu@cvs.openbsd.org> | 2003-05-08 22:34:47 +0000 |
---|---|---|
committer | Ted Unangst <tedu@cvs.openbsd.org> | 2003-05-08 22:34:47 +0000 |
commit | 17fda6262ea4af5b0c453ce710b52aa09f0e7ec7 (patch) | |
tree | c8ab724fbcc2e0171eb5c0e7be8caa77fbf0d544 /usr.sbin/bind/lib/isc/unix | |
parent | 6f06a03a07d2361a33a9a6e7c69570f547bbe4f5 (diff) |
replace strcpy with strlcpy and some strdup.
ok rohee@ tdeval@ dhartmei@
requested by deraadt@
Diffstat (limited to 'usr.sbin/bind/lib/isc/unix')
-rw-r--r-- | usr.sbin/bind/lib/isc/unix/dir.c | 4 | ||||
-rw-r--r-- | usr.sbin/bind/lib/isc/unix/file.c | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/usr.sbin/bind/lib/isc/unix/dir.c b/usr.sbin/bind/lib/isc/unix/dir.c index 211ce0393d0..f40ab1ba653 100644 --- a/usr.sbin/bind/lib/isc/unix/dir.c +++ b/usr.sbin/bind/lib/isc/unix/dir.c @@ -97,7 +97,7 @@ isc_dir_read(isc_dir_t *dir) { if (sizeof(dir->entry.name) <= strlen(entry->d_name)) return (ISC_R_UNEXPECTED); - strcpy(dir->entry.name, entry->d_name); + strlcpy(dir->entry.name, entry->d_name, sizeof(dir->entry.name)); /* * Some dirents have d_namlen, but it is not portable. @@ -177,7 +177,7 @@ isc_dir_current(char *dirname, size_t length, isc_boolean_t end_sep) { if (strlen(dirname) + 1 == length) result = ISC_R_NOSPACE; else if (dirname[1] != '\0') - strcat(dirname, "/"); + strlcat(dirname, "/", length); } return (result); diff --git a/usr.sbin/bind/lib/isc/unix/file.c b/usr.sbin/bind/lib/isc/unix/file.c index 1e3d96db95f..95f5428ca43 100644 --- a/usr.sbin/bind/lib/isc/unix/file.c +++ b/usr.sbin/bind/lib/isc/unix/file.c @@ -147,12 +147,12 @@ isc_file_template(const char *path, const char *templet, char *buf, strncpy(buf, path, s - path + 1); buf[s - path + 1] = '\0'; - strcat(buf, templet); + strlcat(buf, templet, buflen); } else { if ((strlen(templet) + 1) > buflen) return (ISC_R_NOSPACE); - strcpy(buf, templet); + strlcpy(buf, templet, buflen); } return (ISC_R_SUCCESS); @@ -310,6 +310,6 @@ isc_file_absolutepath(const char *filename, char *path, size_t pathlen) { return (result); if (strlen(path) + strlen(filename) + 1 > pathlen) return (ISC_R_NOSPACE); - strcat(path, filename); + strlcat(path, filename, pathlen); return (ISC_R_SUCCESS); } |