* grub-core/lib/legacy_parse.c (grub_legacy_escape): Correctly handle
single quotes.
(grub_legacy_parse): Likewise.
Reported by: Jordan Uggla.
Tested by: Jordan Uggla.
+2010-11-14 Vladimir Serbinenko <phcoder@gmail.com>
+
+ Fix quoting in legacy parser.
+
+ * grub-core/lib/legacy_parse.c (grub_legacy_escape): Correctly handle
+ single quotes.
+ (grub_legacy_parse): Likewise.
+ Reported by: Jordan Uggla.
+ Tested by: Jordan Uggla.
+
2010-11-14 Vladimir Serbinenko <phcoder@gmail.com>
Don't add -lgcc on i386 and x86_64.
char *ret, *outptr;
int overhead = 0;
for (ptr = in; ptr < in + len && *ptr; ptr++)
- if (*ptr == '\'' || *ptr == '\\')
- overhead++;
+ if (*ptr == '\'')
+ overhead += 3;
ret = grub_malloc (ptr - in + overhead + 1);
if (!ret)
return NULL;
outptr = ret;
for (ptr = in; ptr < in + len && *ptr; ptr++)
{
- if (*ptr == '\'' || *ptr == '\\')
- *outptr++ = '\\';
+ if (*ptr == '\'')
+ {
+ *outptr++ = '\'';
+ *outptr++ = '\\';
+ *outptr++ = '\'';
+ *outptr++ = '\'';
+ continue;
+ }
*outptr++ = *ptr;
}
{
for (; *ptr && grub_isspace (*ptr); ptr++);
for (; *ptr && !grub_isspace (*ptr); ptr++)
- if (*ptr == '\\' || *ptr == '\'')
- overhead++;
+ if (*ptr == '\'')
+ overhead += 3;
if (*ptr)
ptr++;
overhead += 3;
}
+
outptr0 = args[i] = grub_malloc (overhead + (ptr - curarg));
if (!outptr0)
return NULL;
*outptr++ = '\'';
for (; *ptr && !grub_isspace (*ptr); ptr++)
{
- if (*ptr == '\\' || *ptr == '\'')
- *outptr++ = '\\';
- *outptr++ = *ptr;
+ if (*ptr == '\'')
+ {
+ *outptr++ = '\'';
+ *outptr++ = '\\';
+ *outptr++ = '\'';
+ *outptr++ = '\'';
+ }
+ else
+ *outptr++ = *ptr;
}
*outptr++ = '\'';
if (*ptr)