zephyr/subsys/llext
Luca Burelli 681c7da7c8 llext: fix fixed-length name buffer usage
This was inspired by the detection of 2 instances of the warning:

   warning: 'strncpy' specified bound 16 equals destination size
            [-Wstringop-truncation]

The current code is already safe with regards to overflows, because
fixed-length string functions are used in the call tree. However, when
given a name 16 chars or larger, the current compare in llext_by_name()
will not work as expected because the stored extension name is truncated
to a max of 15.

Define a global LLEXT_MAX_NAME_LEN constant to simplify all this logic
and also implement name checks in the shell before calling llext_load().

Finally, using strlen() instead of strnlen() gets the real length of the
hex string passed as a parameter, which is important for the next safety
check.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
2025-03-19 01:23:59 +01:00
..
buf_loader.c
CMakeLists.txt llext: Add RISC-V arch-specific relocations 2024-10-03 21:59:42 +01:00
fs_loader.c llext: Add filesystem based extension loader 2024-09-06 11:26:09 -04:00
Kconfig llext-edk: add support for Zstd and Zip formats 2025-02-14 13:35:43 +01:00
llext_export.c llext: fix link order for weak syscall symbols 2024-12-10 20:38:48 +01:00
llext_handlers.c llext: hotfix: fix function pointer logging 2024-09-11 13:59:02 -04:00
llext_link.c llext: avoid direct llext_string() usage 2025-03-17 19:58:15 +01:00
llext_load.c llext: support alignment requirements for sections 2025-03-17 19:58:15 +01:00
llext_mem.c llext: support alignment requirements for sections 2025-03-17 19:58:15 +01:00
llext_priv.h llext: avoid redundant 'ldr_parm' checks 2025-03-17 19:58:15 +01:00
llext.c llext: fix fixed-length name buffer usage 2025-03-19 01:23:59 +01:00
shell.c llext: fix fixed-length name buffer usage 2025-03-19 01:23:59 +01:00