Skip to content
Commit 681c7da7 authored by Luca Burelli's avatar Luca Burelli Committed by Benjamin Cabé
Browse files

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: default avatarLuca Burelli <l.burelli@arduino.cc>
parent d2c49544
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment