diff --git a/Source/exehead/Main.c b/Source/exehead/Main.c index c390b090..04811d7d 100644 --- a/Source/exehead/Main.c +++ b/Source/exehead/Main.c @@ -110,7 +110,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInst,LPSTR lpszCmdParam, if (*cmdline == '\"') seekchar = *cmdline++; while (*cmdline && *cmdline != seekchar) cmdline=CharNext(cmdline); - if (*cmdline) cmdline=CharNext(cmdline); + cmdline=CharNext(cmdline); realcmds=cmdline; for (;;) diff --git a/Source/exehead/exec.c b/Source/exehead/exec.c index 043410d0..c16a68c9 100644 --- a/Source/exehead/exec.c +++ b/Source/exehead/exec.c @@ -237,12 +237,10 @@ static int NSISCALL ExecuteEntry(entry *entry_) } else update_status_text_from_lang(LANG_CREATEDIR,buf1); { - char *tp; - char *p; - p=buf1; - while (*p == ' ') p=CharNext(p); + char *tp=CharNext(buf1); + char *p=buf1; + char c = 'c'; if (*p) { - tp=CharNext(p); if (*(WORD*)tp == CHAR2_TO_WORD(':','\\')) p=tp+2; else if (*(WORD*)p == CHAR2_TO_WORD('\\','\\')) { @@ -250,21 +248,18 @@ static int NSISCALL ExecuteEntry(entry *entry_) for (x = 0; x < 2; x ++) { while (*p != '\\' && *p) p=CharNext(p); // skip host then share - if (*p) p=CharNext(p); + p=CharNext(p); } } else return 0; - while (*p) + while (c) { while (*p != '\\' && *p) p=CharNext(p); - if (!*p) CreateDirectory(buf1,NULL); - else - { - *p=0; - CreateDirectory(buf1,NULL); - *p++ = '\\'; - } + c=*p; + *p=0; + g_flags.exec_error += !CreateDirectory(buf1,NULL); + *p++ = c; } } } diff --git a/Source/exehead/util.c b/Source/exehead/util.c index 9c80582e..fb323b6d 100644 --- a/Source/exehead/util.c +++ b/Source/exehead/util.c @@ -521,6 +521,7 @@ char * NSISCALL validate_filename(char *in) { short cur_char = 0; char *out; char *out_save; + while (*in == ' ') in=CharNext(in); if (in[0] && in[1] && in[2]) { // at least four bytes if (*(DWORD*)in == CHAR4_TO_DWORD('\\', '\\', '?', '\\')) in += 4; @@ -529,11 +530,12 @@ char * NSISCALL validate_filename(char *in) { // at least two bytes if (in[0] && validpathspec(in)) in += 2; } - out = in; - out_save = out; - while (*(char*)&cur_char = *in++) { + out = out_save = in; + while (*(char*)&cur_char = *in) { if (!mystrstr(nono, (char*)&cur_char)) - *out++ = *(char*)&cur_char; + mini_memcpy(out, in, CharNext(in) - in); + in = CharNext(in); + out = CharNext(out); } do { *out = 0;