Module Name: src
Committed By: christos
Date: Thu Sep 22 12:43:09 UTC 2011
Modified Files:
src/dist/smbfs/lib/smb: subr.c
Log Message:
Eliminate unchecked malloc (Maksymilian Arciemowicz)
To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/dist/smbfs/lib/smb/subr.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/dist/smbfs/lib/smb/subr.c
diff -u src/dist/smbfs/lib/smb/subr.c:1.5 src/dist/smbfs/lib/smb/subr.c:1.6
--- src/dist/smbfs/lib/smb/subr.c:1.5 Thu Jun 26 22:09:49 2008
+++ src/dist/smbfs/lib/smb/subr.c Thu Sep 22 08:43:09 2011
@@ -33,7 +33,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: subr.c,v 1.5 2008/06/27 02:09:49 gmcgarry Exp $");
+__RCSID("$NetBSD: subr.c,v 1.6 2011/09/22 12:43:09 christos Exp $");
#include <sys/param.h>
#include <sys/types.h>
@@ -169,10 +169,9 @@
home = getenv("HOME");
if (home) {
- fn = malloc(strlen(home) + 20);
- sprintf(fn, "%s/.nsmbrc", home);
+ char fn[1024];
+ snprintf(fn, sizeof(fn), "%s/.nsmbrc", home);
error = rc_open(fn, "r", &smb_rc);
- free(fn);
}
error = rc_merge(SMB_CFG_FILE, &smb_rc);
if (smb_rc == NULL)