Skip to content

Commit 7b9bdfc

Browse files
author
Fox Snowpatch
committed
1 parent 5c2c0ba commit 7b9bdfc

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

arch/powerpc/boot/devtree.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,11 +343,16 @@ int dt_is_compatible(void *node, const char *compat)
343343
if (len < 0)
344344
return 0;
345345

346-
for (pos = 0; pos < len; pos++) {
346+
for (pos = 0; pos < len; ) {
347+
int entry_len = strnlen(&buf[pos], len - pos);
348+
349+
if (entry_len == len - pos)
350+
return 0;
351+
347352
if (!strcmp(buf + pos, compat))
348353
return 1;
349354

350-
pos += strnlen(&buf[pos], len - pos);
355+
pos += entry_len + 1;
351356
}
352357

353358
return 0;

0 commit comments

Comments
 (0)