Skip to content
Snippets Groups Projects
Commit 8805beec authored by Joe Hershberger's avatar Joe Hershberger Committed by Gerald Van Baren
Browse files

fdt: Identify scripts in ITBs as printable strings


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: default avatarJoe Hershberger <joe.hershberger@ni.com>
parent bc80295b
No related branches found
No related tags found
No related merge requests found
...@@ -754,12 +754,12 @@ static int is_printable_string(const void *data, int len) ...@@ -754,12 +754,12 @@ static int is_printable_string(const void *data, int len)
if (len == 0) if (len == 0)
return 0; return 0;
/* must terminate with zero */ /* must terminate with zero or '\n' */
if (s[len - 1] != '\0') if (s[len - 1] != '\0' && s[len - 1] != '\n')
return 0; return 0;
/* printable or a null byte (concatenated strings) */ /* 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: * If we see a null, there are three possibilities:
* 1) If len == 1, it is the end of the string, printable * 1) If len == 1, it is the end of the string, printable
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment