[U-Boot] [PATCH 4/6] fdt: Identify scripts in ITBs as printable strings

Joe Hershberger joe.hershberger at ni.com
Fri Aug 17 22:34:38 CEST 2012


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 at ni.com>
---
 common/cmd_fdt.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/common/cmd_fdt.c b/common/cmd_fdt.c
index 60983af..6ba0e86 100644
--- a/common/cmd_fdt.c
+++ b/common/cmd_fdt.c
@@ -743,12 +743,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
-- 
1.7.11.5



More information about the U-Boot mailing list