summaryrefslogtreecommitdiff
path: root/scripts/dtc/pylibfdt/setup.py
diff options
context:
space:
mode:
authorMikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>2025-06-10 12:56:30 +0300
committerTom Rini <trini@konsulko.com>2025-06-19 11:01:51 -0600
commit3704b888a4cabac8daea20a4504d513bc47153ca (patch)
tree224dd67a682426bf5abeeaf3a72a7cfb39f6b3ad /scripts/dtc/pylibfdt/setup.py
parent17012e3068d047ad71460f039eeb0c3be63f82a0 (diff)
common/spl: fix potential out of buffer access in spl_fit_get_image_name function
The current code have two issues: 1) ineffective NULL pointer check str = strchr(str, '\0') + 1 if (!str || ... The str here will never be NULL (because we add 1 to result of strchr()) 2) strchr() may go out of the buffer for the special forms of name variable. It's better use memchr() function here. According to the code the property is a sequence of C-string like shown below: 'h', 'e', 'l', 'l', 'o', '\0', 'w', 'o', 'r', 'l', 'd', '\0', '!', '\0' index is the string number we are interested, so index = 0 => "hello", index = 1 => "world", index = 2 => "!" The issue will arrise if last string for some reason have no terminating '\0' character. This can happen for damaged or specially crafted dtb. Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu> Reviewed-by: Tom Rini <trini@konsulko.com>
Diffstat (limited to 'scripts/dtc/pylibfdt/setup.py')
0 files changed, 0 insertions, 0 deletions