improved quoting of args
This commit is contained in:
parent
7644c1d064
commit
e1a4f3d031
|
@ -1036,24 +1036,23 @@ int is_allowed_host(Octstr *host, Octstr *host_list)
|
|||
return ret;
|
||||
}
|
||||
|
||||
#define SHELLCHARS "'|\"()[]{}$&!?*><%`\n \t"
|
||||
#define SHELLCHARS "'|\"()[]{}$&!?*><%`\n \t\\"
|
||||
void escape_shell_chars(Octstr *str)
|
||||
{
|
||||
Octstr *tmp;
|
||||
int i, n, prev;
|
||||
int i, n;
|
||||
|
||||
octstr_strip_blanks(str);
|
||||
|
||||
tmp = octstr_duplicate(str);
|
||||
octstr_delete(str, 0, octstr_len(str));
|
||||
|
||||
for (i = 0, prev=0, n = octstr_len(tmp); i < n; i++) {
|
||||
for (i = 0, n = octstr_len(tmp); i < n; i++) {
|
||||
int ch = octstr_get_char(tmp,i);
|
||||
|
||||
if (strchr(SHELLCHARS, ch) != NULL && prev != '\\')
|
||||
if (strchr(SHELLCHARS, ch) != NULL)
|
||||
octstr_append_char(str, '\\');
|
||||
octstr_append_char(str, ch);
|
||||
prev = ch;
|
||||
}
|
||||
octstr_destroy(tmp);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue