From 144766057c07daf7719b2fcee4c45afa3c829af5 Mon Sep 17 00:00:00 2001 From: Jeong Han Lee <jeonghan.lee@gmail.com> Date: Tue, 18 Sep 2018 17:52:54 +0200 Subject: [PATCH] potential memory corruption in iocshlocation --- require.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/require.c b/require.c index 60aa5188..37a2ef3e 100644 --- a/require.c +++ b/require.c @@ -666,7 +666,7 @@ void registerModule(const char* module, const char* version, const char* locatio return; } - iocshlocation = malloc( strlen(abslocation) + strlen(iocshpath) ); + iocshlocation = (char*) malloc( strlen(abslocation) + strlen(iocshpath) + ll + addSlash ); if (iocshlocation == NULL) { fprintf(stderr, "require: registerModule: cannot allocate memory on iocshlocation \n"); @@ -693,7 +693,7 @@ void registerModule(const char* module, const char* version, const char* locatio if (location) { putenvprintf("%s_DIR=%s", module, m->content+lm+lv); - pathAdd("SCRIPT_PATH", m->content+lm+lv); + /* pathAdd("SCRIPT_PATH", m->content+lm+lv);*/ pathAdd("SCRIPT_PATH", iocshlocation); } -- GitLab