Fix wildcard regexp dot and other special characters handling.

Reported by: Robert Mabee.

	* grub-core/commands/wildcard.c (isregexop): Add "|+{}[]?".
	(make_regex): Escape "|+{}[]". Transform '?' to '.?'.
	(split_path): Trigger expansion on '?'.
	(unescape): New function.
	(wildcard_expand): Unescape parts copied without globbing.
	* grub-core/script/execute.c (wildcard_escape): Escape '?'.
	(grub_script_arglist_to_argv): Don't unescape expansions.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2012-06-19 14:13:19 +02:00
parent 0494408e7e
commit 485568790c
3 changed files with 52 additions and 9 deletions

View file

@ -68,7 +68,7 @@ wildcard_escape (const char *s)
i = 0;
while ((ch = *s++))
{
if (ch == '*' || ch == '\\')
if (ch == '*' || ch == '\\' || ch == '?')
p[i++] = '\\';
p[i++] = ch;
}
@ -706,7 +706,7 @@ grub_script_arglist_to_argv (struct grub_script_arglist *arglist,
for (j = 0; expansions[j]; j++)
{
failed = (failed || grub_script_argv_next (&result) ||
append (expansions[j], -1));
append (expansions[j], 0));
grub_free (expansions[j]);
}
grub_free (expansions);