summaryrefslogtreecommitdiffstats
path: root/usr.sbin/httpd/src
diff options
context:
space:
mode:
authorhenning <henning@openbsd.org>2003-04-08 19:54:54 +0000
committerhenning <henning@openbsd.org>2003-04-08 19:54:54 +0000
commit3f68ed287bf1a33536166a3495a8be3cca4cea9a (patch)
tree837da16ddcb80a6cefc660e18393a924f2e1b1e3 /usr.sbin/httpd/src
parentstring cleanup; ok tdeval (diff)
downloadwireguard-openbsd-3f68ed287bf1a33536166a3495a8be3cca4cea9a.tar.xz
wireguard-openbsd-3f68ed287bf1a33536166a3495a8be3cca4cea9a.zip
string fixes in code we don't compile by default; tedu help & ok
Diffstat (limited to 'usr.sbin/httpd/src')
-rw-r--r--usr.sbin/httpd/src/lib/sdbm/sdbm.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/usr.sbin/httpd/src/lib/sdbm/sdbm.c b/usr.sbin/httpd/src/lib/sdbm/sdbm.c
index f0a20f2e27a..6aac7be6543 100644
--- a/usr.sbin/httpd/src/lib/sdbm/sdbm.c
+++ b/usr.sbin/httpd/src/lib/sdbm/sdbm.c
@@ -77,18 +77,15 @@ register int mode;
if (file == NULL || !*file)
return errno = EINVAL, (DBM *) NULL;
/*
- * need space for two seperate filenames
- */
- n = strlen(file) * 2 + strlen(DIRFEXT) + strlen(PAGFEXT) + 2;
-
- if ((dirname = malloc((unsigned) n)) == NULL)
- return errno = ENOMEM, (DBM *) NULL;
-/*
* build the file names
*/
- dirname = strcat(strcpy(dirname, file), DIRFEXT);
- pagname = strcpy(dirname + strlen(dirname) + 1, file);
- pagname = strcat(pagname, PAGFEXT);
+ if (asprintf(&dirname, "%s%s", file, DIRFEXT) == -1)
+ return (DBM *) NULL;
+
+ if (asprintf(&pagname, "%s%s", file, PAGFEXT) == -1) {
+ free(dirname);
+ return (DBM *) NULL;
+ }
#ifdef NETWARE
locking_sem = OpenLocalSemaphore (1);