Skip to content

Commit

Permalink
Merge pull request #65 from yujincheng08/patch-1
Browse files Browse the repository at this point in the history
Fix a UB when fdt_get_string return null
  • Loading branch information
dgibson authored Dec 28, 2021
2 parents c3be7b8 + 734024e commit 9e6d9f3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libfdt/fdt_ro.c
Original file line number Diff line number Diff line change
Expand Up @@ -481,12 +481,12 @@ const void *fdt_getprop_by_offset(const void *fdt, int offset,
if (!can_assume(VALID_INPUT)) {
name = fdt_get_string(fdt, fdt32_ld_(&prop->nameoff),
&namelen);
*namep = name;
if (!name) {
if (lenp)
*lenp = namelen;
return NULL;
}
*namep = name;
} else {
*namep = fdt_string(fdt, fdt32_ld_(&prop->nameoff));
}
Expand Down

0 comments on commit 9e6d9f3

Please sign in to comment.