Skip to content
Snippets Groups Projects
Commit 52fa5841 authored by Fredrik Hübinette (Hubbe)'s avatar Fredrik Hübinette (Hubbe)
Browse files

bugfix for Process.split_quoted_string

Rev: lib/modules/Process.pmod:1.25
parent 9107319d
No related branches found
No related tags found
No related merge requests found
...@@ -34,6 +34,7 @@ string sh_quote(string s) ...@@ -34,6 +34,7 @@ string sh_quote(string s)
array(string) split_quoted_string(string s) array(string) split_quoted_string(string s)
{ {
sscanf(s,"%*[ \n\t]%s",s);
s=replace(s, s=replace(s,
({"\"", "'", "\\", " ", "\t", "\n"}), ({"\"", "'", "\\", " ", "\t", "\n"}),
({"\0\"","\0'","\0\\","\0 ","\0\t","\0\n"})); ({"\0\"","\0'","\0\\","\0 ","\0\t","\0\n"}));
...@@ -56,7 +57,7 @@ array(string) split_quoted_string(string s) ...@@ -56,7 +57,7 @@ array(string) split_quoted_string(string s)
case '\'': case '\'':
ret[-1]+=x[e][1..]; ret[-1]+=x[e][1..];
while(x[++e][0]!='\'') ret[-1]+=x[e]; while(x[++e][0]!='\'') ret[-1]+=x[e][1..];
ret[-1]+=x[e][1..]; ret[-1]+=x[e][1..];
break; break;
...@@ -72,7 +73,8 @@ array(string) split_quoted_string(string s) ...@@ -72,7 +73,8 @@ array(string) split_quoted_string(string s)
case ' ': case ' ':
case '\t': case '\t':
case '\n': case '\n':
while(strlen(x[e])==1 && (<' ','\t','\n'>) [x[e][0]] ) while(strlen(x[e])==1 && e+1 < sizeof(x) &&
(<' ','\t','\n'>) [x[e+1][0]])
if(++e >= sizeof(x)) if(++e >= sizeof(x))
return ret; return ret;
ret+=({x[e][1..]}); ret+=({x[e][1..]});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment