From fdb0e0bed79bac86e8b39d3bb4eaf39a44b7bede Mon Sep 17 00:00:00 2001 From: h_vogt Date: Sun, 22 Feb 2009 21:02:25 +0000 Subject: [PATCH] remove heap overflow ion tfree(path) --- ChangeLog | 1 + src/main.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index fcff67db8..4c9784b60 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,7 @@ (755 instead of 644) * fteext.h spiceif.c options.c dotcards.c: .options NOACCT added * /tests/.../*.cir .options noacct added (except BSIM3 files) + * main.c:614 allow null terminator in string 2009-02-22 Dietmar Warning * devices/adms/mextram: Update to release version 504.7 now with selfheating diff --git a/src/main.c b/src/main.c index df4bf664d..cbf779aec 100644 --- a/src/main.c +++ b/src/main.c @@ -611,7 +611,7 @@ read_initialisation_file(char * dir, char * name) asprintf(&path, "%s" DIR_PATHSEP "%s", dir,name); if(path==NULL) return FALSE; /* memory allocation error */ #else /* ~ HAVE_ASPRINTF */ - path=(char*)tmalloc(1 + strlen(dir)+strlen(name)); + path=(char*)tmalloc(2 + strlen(dir)+strlen(name)); if(path==NULL) return FALSE; /* memory allocation error */ sprintf(path,"%s" DIR_PATHSEP "%s",dir,name); #endif /* HAVE_ASPRINTF */