diff options
author | Federico G. Schwindt <fgsch@cvs.openbsd.org> | 2000-06-20 07:33:52 +0000 |
---|---|---|
committer | Federico G. Schwindt <fgsch@cvs.openbsd.org> | 2000-06-20 07:33:52 +0000 |
commit | af364c0852af5127ec32a5ac80c0d62a8b2bd298 (patch) | |
tree | 55de423c1399fdb54c88df9bdd21afb76af4b2e6 /usr.bin/tcfs | |
parent | cff5c95ca305a8d4ef761d188332c89917f73cd3 (diff) |
replace some calloc's with malloc's since there is no point in call
memset for a sprintf buffer. fix malloc's len.
Diffstat (limited to 'usr.bin/tcfs')
-rw-r--r-- | usr.bin/tcfs/tcfs_dbmaint.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/usr.bin/tcfs/tcfs_dbmaint.c b/usr.bin/tcfs/tcfs_dbmaint.c index 66a6a4893fa..a753f4bfdf6 100644 --- a/usr.bin/tcfs/tcfs_dbmaint.c +++ b/usr.bin/tcfs/tcfs_dbmaint.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tcfs_dbmaint.c,v 1.9 2000/06/20 07:09:45 fgsch Exp $ */ +/* $OpenBSD: tcfs_dbmaint.c,v 1.10 2000/06/20 07:33:51 fgsch Exp $ */ /* * Transparent Cryptographic File System (TCFS) for NetBSD @@ -241,12 +241,11 @@ tcfs_ggetpwnam(char *user, gid_t gid, tcfsgpwdb **dest) if (!pdb) return (NULL); - key = (char *)calloc(strlen(user) + 4 /* gid length */ + 1 /* null */, - sizeof(char)); + key = (char *)malloc(strlen(user) + 6); if (!key) return (NULL); - sprintf(key, "%s\33%d\0", user, (int)gid); + sprintf(key, "%s\33%d", user, (int)gid); srchkey.data = key; srchkey.size = (int)strlen(key); @@ -320,8 +319,8 @@ tcfs_gputpwnam(char *user, tcfsgpwdb *src, int flags) return (0); } - key = (char *)calloc(strlen(src->user) + 4 + 1, sizeof(char)); - sprintf(key, "%s\33%d\0", src->user, src->gid); + key = (char *)malloc(strlen(src->user) + 6); + sprintf(key, "%s\33%d", src->user, (int)src->gid); srchkey.data = key; srchkey.size = strlen(key); @@ -363,7 +362,7 @@ tcfs_rmgroup(gid_t gid) tmp = (char *)calloc(1024, sizeof(char)); - sprintf(tmp, "\33%d\0", gid); + sprintf(tmp, "\33%d", gid); if (strstr(dbkey.data, tmp)) { if (gdb->del(gdb, &dbkey, 0)) { gdb->close(gdb); |