Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 911363 Details for
Bug 923374
grub2 improperly escapes spaces in kernel parameters
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
Updated version of 0066-Pass-x-hex-hex-straight-through-unmolested.patch fixing this bug
0066-Pass-x-hex-hex-straight-through-unmolested.patch (text/plain), 4.39 KB, created by
Hans de Goede
on 2014-06-23 09:13:00 UTC
(
hide
)
Description:
Updated version of 0066-Pass-x-hex-hex-straight-through-unmolested.patch fixing this bug
Filename:
MIME Type:
Creator:
Hans de Goede
Created:
2014-06-23 09:13:00 UTC
Size:
4.39 KB
patch
obsolete
>From 6e8b72a26bc7a42903b6c75b131981ceac59f6ef Mon Sep 17 00:00:00 2001 >From: Peter Jones <pjones@redhat.com> >Date: Mon, 1 Oct 2012 13:24:37 -0400 >Subject: [PATCH 066/112] Pass "\x[[:hex:]][[:hex:]]" straight through > unmolested. > >--- > grub-core/commands/wildcard.c | 16 +++++++++++++++- > grub-core/lib/cmdline.c | 34 ++++++++++++++++++++++++++++++++-- > grub-core/script/execute.c | 43 +++++++++++++++++++++++++++++++++++++------ > 3 files changed, 84 insertions(+), 9 deletions(-) > >diff --git a/grub-core/commands/wildcard.c b/grub-core/commands/wildcard.c >index 2807f80..0f40e04 100644 >--- a/grub-core/commands/wildcard.c >+++ b/grub-core/commands/wildcard.c >@@ -458,6 +458,12 @@ check_file (const char *dir, const char *basename) > return ctx.found; > } > >+static int >+is_hex(char c) >+{ >+ return ((c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F')); >+} >+ > static void > unescape (char *out, const char *in, const char *end) > { >@@ -466,7 +472,15 @@ unescape (char *out, const char *in, const char *end) > > for (optr = out, iptr = in; iptr < end;) > { >- if (*iptr == '\\' && iptr + 1 < end) >+ if (*iptr == '\\' && iptr + 3 < end && iptr[1] == 'x' && is_hex(iptr[2]) && is_hex(iptr[3])) >+ { >+ *optr++ = *iptr++; >+ *optr++ = *iptr++; >+ *optr++ = *iptr++; >+ *optr++ = *iptr++; >+ continue; >+ } >+ else if (*iptr == '\\' && iptr + 1 < end) > { > *optr++ = iptr[1]; > iptr += 2; >diff --git a/grub-core/lib/cmdline.c b/grub-core/lib/cmdline.c >index d5e10ee..0a5b2af 100644 >--- a/grub-core/lib/cmdline.c >+++ b/grub-core/lib/cmdline.c >@@ -20,6 +20,12 @@ > #include <grub/lib/cmdline.h> > #include <grub/misc.h> > >+static int >+is_hex(char c) >+{ >+ return ((c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F')); >+} >+ > static unsigned int check_arg (char *c, int *has_space) > { > int space = 0; >@@ -27,7 +33,13 @@ static unsigned int check_arg (char *c, int *has_space) > > while (*c) > { >- if (*c == '\\' || *c == '\'' || *c == '"') >+ if (*c == '\\' && *(c+1) == 'x' && is_hex(*(c+2)) && is_hex(*(c+3))) >+ { >+ size += 4; >+ c += 4; >+ continue; >+ } >+ else if (*c == '\\' || *c == '\'' || *c == '"') > size++; > else if (*c == ' ') > space = 1; >@@ -85,7 +97,16 @@ int grub_create_loader_cmdline (int argc, char *argv[], char *buf, > > while (*c) > { >- if (*c == '\\' || *c == '\'' || *c == '"') >+ if (*c == '\\' && *(c+1) == 'x' && >+ is_hex(*(c+2)) && is_hex(*(c+3))) >+ { >+ *buf++ = *c++; >+ *buf++ = *c++; >+ *buf++ = *c++; >+ *buf++ = *c++; >+ continue; >+ } >+ else if (*c == '\\' || *c == '\'' || *c == '"') > *buf++ = '\\'; > > *buf++ = *c; >diff --git a/grub-core/script/execute.c b/grub-core/script/execute.c >index afd5513..8f01c1b 100644 >--- a/grub-core/script/execute.c >+++ b/grub-core/script/execute.c >@@ -52,6 +52,12 @@ static struct grub_script_scope *scope = 0; > /* Wildcard translator for GRUB script. */ > struct grub_script_wildcard_translator *grub_wildcard_translator; > >+static int >+is_hex(char c) >+{ >+ return ((c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F')); >+} >+ > static char* > wildcard_escape (const char *s) > { >@@ -68,7 +74,15 @@ wildcard_escape (const char *s) > i = 0; > while ((ch = *s++)) > { >- if (ch == '*' || ch == '\\' || ch == '?') >+ if (ch == '\\' && s[0] == 'x' && is_hex(s[1]) && is_hex(s[2])) >+ { >+ p[i++] = ch; >+ p[i++] = *s++; >+ p[i++] = *s++; >+ p[i++] = *s++; >+ continue; >+ } >+ else if (ch == '*' || ch == '\\' || ch == '?') > p[i++] = '\\'; > p[i++] = ch; > } >@@ -92,7 +106,14 @@ wildcard_unescape (const char *s) > i = 0; > while ((ch = *s++)) > { >- if (ch == '\\') >+ if (ch == '\\' && s[0] == 'x' && is_hex(s[1]) && is_hex(s[2])) >+ { >+ p[i++] = '\\'; >+ p[i++] = *s++; >+ p[i++] = *s++; >+ p[i++] = *s++; >+ } >+ else if (ch == '\\') > p[i++] = *s++; > else > p[i++] = ch; >@@ -394,10 +415,20 @@ parse_string (const char *str, > switch (*ptr) > { > case '\\': >- escaped = !escaped; >- if (!escaped && put) >- *(put++) = '\\'; >- ptr++; >+ if (!escaped && put && *(ptr+1) == 'x' && is_hex(*(ptr+2)) && is_hex(*(ptr+3))) >+ { >+ *(put++) = *ptr++; >+ *(put++) = *ptr++; >+ *(put++) = *ptr++; >+ *(put++) = *ptr++; >+ } >+ else >+ { >+ escaped = !escaped; >+ if (!escaped && put) >+ *(put++) = '\\'; >+ ptr++; >+ } > break; > case '$': > if (escaped) >-- >1.8.5.3 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 923374
:
839168
| 911363