]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
fdt: Identify scripts in ITBs as printable strings
authorJoe Hershberger <joe.hershberger@ni.com>
Fri, 17 Aug 2012 10:34:38 +0000 (10:34 +0000)
committerGerald Van Baren <gvb@unssw.com>
Mon, 15 Oct 2012 23:20:26 +0000 (19:20 -0400)
Scripts in the ITB format will have spaces in them and will end in a
newline charachter.  Make sure that these are considered printable.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
common/cmd_fdt.c

index 2997452370e29672e1207b951c2e3179cf19f4d9..a5e2cfcbfa8ede2fffd84d5ef1beb13e7f75ff8b 100644 (file)
@@ -754,12 +754,12 @@ static int is_printable_string(const void *data, int len)
        if (len == 0)
                return 0;
 
-       /* must terminate with zero */
-       if (s[len - 1] != '\0')
+       /* must terminate with zero or '\n' */
+       if (s[len - 1] != '\0' && s[len - 1] != '\n')
                return 0;
 
        /* printable or a null byte (concatenated strings) */
-       while (((*s == '\0') || isprint(*s)) && (len > 0)) {
+       while (((*s == '\0') || isprint(*s) || isspace(*s)) && (len > 0)) {
                /*
                 * If we see a null, there are three possibilities:
                 * 1) If len == 1, it is the end of the string, printable