Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/dist/smbfs/lib/smb Eliminate unchecked malloc (Maksymilian A...
details: https://anonhg.NetBSD.org/src/rev/9698add192cc
branches: trunk
changeset: 769765:9698add192cc
user: christos <christos%NetBSD.org@localhost>
date: Thu Sep 22 12:43:09 2011 +0000
description:
Eliminate unchecked malloc (Maksymilian Arciemowicz)
diffstat:
dist/smbfs/lib/smb/subr.c | 7 +++----
1 files changed, 3 insertions(+), 4 deletions(-)
diffs (25 lines):
diff -r a43b77dea8df -r 9698add192cc dist/smbfs/lib/smb/subr.c
--- a/dist/smbfs/lib/smb/subr.c Thu Sep 22 12:40:48 2011 +0000
+++ b/dist/smbfs/lib/smb/subr.c Thu Sep 22 12:43:09 2011 +0000
@@ -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)
Home |
Main Index |
Thread Index |
Old Index