diff options
author | Hans Insulander <hin@cvs.openbsd.org> | 2003-05-11 18:31:29 +0000 |
---|---|---|
committer | Hans Insulander <hin@cvs.openbsd.org> | 2003-05-11 18:31:29 +0000 |
commit | 8324765275e8033e3d80fae0c109cb10dc8eb53e (patch) | |
tree | ddd6eaa317a00e7f932acd17c8fec1db3afa3710 /kerberosV | |
parent | fc2395fc3e8918a15c1ea31f804445d5e952b149 (diff) |
Use asprintf instead of malloc,strcpy,strcat
ok deraadt@ mho@
Diffstat (limited to 'kerberosV')
-rw-r--r-- | kerberosV/src/lib/roken/ndbm_wrap.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/kerberosV/src/lib/roken/ndbm_wrap.c b/kerberosV/src/lib/roken/ndbm_wrap.c index 03a99ae58c4..cabeef7471f 100644 --- a/kerberosV/src/lib/roken/ndbm_wrap.c +++ b/kerberosV/src/lib/roken/ndbm_wrap.c @@ -144,11 +144,9 @@ dbm_open (const char *file, int flags, mode_t mode) { DB *db; int myflags = 0; - char *fn = malloc(strlen(file) + 4); - if(fn == NULL) + char *fn; + if(asprintf(&fn, "%s.db", file) == -1) return NULL; - strcpy(fn, file); - strcat(fn, ".db"); #ifdef HAVE_DB3 if (flags & O_CREAT) myflags |= DB_CREATE; |