"Das U-Boot" Source Tree
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

common/spl: Revert fix potential out of buffer access in spl_fit_get_image_name function

The change in commit 3704b888a4ca ("common/spl: fix potential out of buffer
access in spl_fit_get_image_name function") led to function
spl_fit_get_image_name() no longer detecting if a property does not exist
at a non-zero buffer.

Link: https://lore.kernel.org/u-boot/38f5d078-3328-4bdb-9c95-4fb5fe89ddc2@gmx.de/T/#m59f3a23e675daa992c28d12236de71cae2ca2bb9
Fixes: 3704b888a4ca ("common/spl: fix potential out of buffer access in spl_fit_get_image_name function")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Tested-by: E Shattow <e@freeshell.de>

authored by

Heinrich Schuchardt and committed by
Tom Rini
6ef9a89c 8bb9c275

+2 -3
+2 -3
common/spl/spl_fit.c
··· 86 86 87 87 str = name; 88 88 for (i = 0; i < index; i++) { 89 - str = memchr(str, '\0', name + len - str); 90 - if (!str) { 89 + str = strchr(str, '\0') + 1; 90 + if (!str || (str - name >= len)) { 91 91 found = false; 92 92 break; 93 93 } 94 - str++; 95 94 } 96 95 97 96 if (!found && CONFIG_IS_ENABLED(SYSINFO) && !sysinfo_get(&sysinfo)) {