[syslinux:elflink] ldlinux: Strip whitespace from LABEL directive

syslinux-bot for Matt Fleming matt.fleming at intel.com
Wed Jan 16 04:27:04 PST 2013


Commit-ID:  ab06ca87afc01c1146a878989524eef03f331d7e
Gitweb:     http://www.syslinux.org/commit/ab06ca87afc01c1146a878989524eef03f331d7e
Author:     Matt Fleming <matt.fleming at intel.com>
AuthorDate: Tue, 15 Jan 2013 13:03:51 +0000
Committer:  Matt Fleming <matt.fleming at intel.com>
CommitDate: Tue, 15 Jan 2013 13:03:51 +0000

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 at intel.com>

---
 com32/elflink/ldlinux/readconfig.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/com32/elflink/ldlinux/readconfig.c b/com32/elflink/ldlinux/readconfig.c
index 6a419c6..156acf5 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;


More information about the Syslinux-commits mailing list