aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Fleming <matt.fleming@intel.com>2013-01-15 13:03:51 +0000
committerMatt Fleming <matt.fleming@intel.com>2013-01-15 13:03:51 +0000
commitab06ca87afc01c1146a878989524eef03f331d7e (patch)
tree8e2dce471224c183979293f0ca7080c2ddef64e6
parent37f7635bcfd80b805436665e4d6317bbbe8a0430 (diff)
downloadsyslinux-ab06ca87afc01c1146a878989524eef03f331d7e.tar.gz
syslinux-ab06ca87afc01c1146a878989524eef03f331d7e.tar.xz
syslinux-ab06ca87afc01c1146a878989524eef03f331d7e.zip
ldlinux: Strip whitespace from LABEL directive
Any LABEL directive arguments shouldn't include whitespace characters. If whitespace characters are needed use MENU LABEL. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
-rw-r--r--com32/elflink/ldlinux/readconfig.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/com32/elflink/ldlinux/readconfig.c b/com32/elflink/ldlinux/readconfig.c
index 6a419c6d..156acf57 100644
--- a/com32/elflink/ldlinux/readconfig.c
+++ b/com32/elflink/ldlinux/readconfig.c
@@ -498,18 +498,24 @@ static const char *unlabel(const char *str)
return str;
}
-static const char *refdup_word(char **p)
+static const char *__refdup_word(char *p, char **ref)
{
- char *sp = *p;
+ char *sp = p;
char *ep = sp;
while (*ep && !my_isspace(*ep))
ep++;
- *p = ep;
+ if (ref)
+ *ref = ep;
return refstrndup(sp, ep - sp);
}
+static const char *refdup_word(char **p)
+{
+ return __refdup_word(*p, p);
+}
+
int my_isxdigit(char c)
{
unsigned int uc = c;
@@ -1065,8 +1071,8 @@ do_include:
p = skipspace(p + 5);
/* when first time see "label", it will not really record anything */
record(m, &ld, append);
- ld.label = refstrdup(p);
- ld.kernel = refstrdup(p);
+ ld.label = __refdup_word(p, NULL);
+ ld.kernel = __refdup_word(p, NULL);
/* feng: this is the default type for all */
ld.type = KT_KERNEL;
ld.passwd = NULL;