validate_filename was called before skip_root in is_valid_instpath and so no root directory was ever valid, even with AllowRootDirInstall
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@4293 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
21457af9ac
commit
e0e4e54cea
1 changed files with 12 additions and 3 deletions
|
@ -285,13 +285,19 @@ int NSISCALL is_valid_instpath(char *s)
|
||||||
|
|
||||||
mystrcpy(tmp, s);
|
mystrcpy(tmp, s);
|
||||||
|
|
||||||
validate_filename(tmp);
|
|
||||||
|
|
||||||
root = skip_root(tmp);
|
root = skip_root(tmp);
|
||||||
|
|
||||||
if (!root)
|
if (!root)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
// must be called after skip_root or AllowRootDirInstall won't work.
|
||||||
|
// validate_filename removes trailing blackslashes and so converts
|
||||||
|
// "C:\" to "C:" which is not a valid directory. skip_root returns
|
||||||
|
// NULL for "C:" so the above test returns 0.
|
||||||
|
// validate_filename is called so directories such as "C:\ " will
|
||||||
|
// not pass as a valid non-root directory.
|
||||||
|
validate_filename(root);
|
||||||
|
|
||||||
if ((g_flags & CH_FLAGS_NO_ROOT_DIR) && (!*root || *root == '\\'))
|
if ((g_flags & CH_FLAGS_NO_ROOT_DIR) && (!*root || *root == '\\'))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -684,7 +690,10 @@ void NSISCALL validate_filename(char *in) {
|
||||||
char *nono = "*?|<>/\":";
|
char *nono = "*?|<>/\":";
|
||||||
char *out;
|
char *out;
|
||||||
char *out_save;
|
char *out_save;
|
||||||
while (*in == ' ') in = CharNext(in);
|
|
||||||
|
// ignoring spaces is wrong, " C:\blah" is invalid
|
||||||
|
//while (*in == ' ') in = CharNext(in);
|
||||||
|
|
||||||
if (in[0] == '\\' && in[1] == '\\' && in[2] == '?' && in[3] == '\\')
|
if (in[0] == '\\' && in[1] == '\\' && in[2] == '?' && in[3] == '\\')
|
||||||
{
|
{
|
||||||
// at least four bytes
|
// at least four bytes
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue