From 2cda34fbec1f0a7d069ea2d434816698d3c14864 Mon Sep 17 00:00:00 2001 From: kichik Date: Fri, 15 Dec 2006 11:52:11 +0000 Subject: [PATCH] fixed bug #1616267 - System plugin crash with parenthesis in filename git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@4844 212acab6-be3b-0410-9dea-997c60f758d6 --- Contrib/System/Source/System.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/Contrib/System/Source/System.c b/Contrib/System/Source/System.c index 5dce29ec..f4644967 100644 --- a/Contrib/System/Source/System.c +++ b/Contrib/System/Source/System.c @@ -139,6 +139,12 @@ PLUGINFUNCTION(Debug) PLUGINFUNCTION(Get) { SystemProc *proc = PrepareProc(FALSE); + if (proc == NULL) + { + pushstring("error"); + return; + } + SYSTEM_LOG_ADD("Get "); SYSTEM_LOG_ADD(proc->DllName); SYSTEM_LOG_ADD("::"); @@ -169,6 +175,9 @@ PLUGINFUNCTION(Call) { // Prepare input SystemProc *proc = PrepareProc(TRUE); + if (proc == NULL) + return; + SYSTEM_LOG_ADD("Call "); SYSTEM_LOG_ADD(proc->DllName); SYSTEM_LOG_ADD("::"); @@ -320,6 +329,13 @@ SystemProc *PrepareProc(BOOL NeedForCall) // Check for Section Change BOOL changed = TRUE; ChangesDone = SectionType; + + if (SectionType != PST_PROC && proc == NULL) + // no proc after PST_PROC is done means something is wrong with + // the call syntax and we'll get a crash because everything needs + // proc from here on. + break; + switch (*ib) { case 0x0: SectionType = -1; break; @@ -640,7 +656,7 @@ SystemProc *PrepareProc(BOOL NeedForCall) GlobalFree(sbuf); // Ok, the final step: check proc for existance - if (proc->Proc == NULL) + if (proc != NULL && proc->Proc == NULL) { switch (proc->ProcType) {