summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/lib/device_tree.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/lib/device_tree.c b/src/lib/device_tree.c
index 352f2545dbb4..ab9c937b38b6 100644
--- a/src/lib/device_tree.c
+++ b/src/lib/device_tree.c
@@ -75,10 +75,14 @@ static void print_property(const struct fdt_property *prop, int depth)
int is_string = prop->size > 0 &&
((char *)prop->data)[prop->size - 1] == '\0';
- if (is_string)
- for (const char *c = prop->data; *c != '\0'; c++)
- if (!isprint(*c))
+ if (is_string) {
+ for (int i = 0; i < prop->size - 1; i++) {
+ if (!isprint(((char *)prop->data)[i])) {
is_string = 0;
+ break;
+ }
+ }
+ }
print_indent(depth);
if (is_string) {