mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-24 13:43:28 +00:00
common: event: check event_type_name() argument
In event_type_name() we should avoid possible buffer overruns by checking the type argument. Addresses-Coverity-ID: 478862 Out-of-bounds access Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
This commit is contained in:
parent
dd0807804e
commit
0c5110ccf8
1 changed files with 4 additions and 1 deletions
|
@ -56,7 +56,10 @@ _Static_assert(ARRAY_SIZE(type_name) == EVT_COUNT, "event type_name size");
|
|||
const char *event_type_name(enum event_t type)
|
||||
{
|
||||
#if CONFIG_IS_ENABLED(EVENT_DEBUG)
|
||||
return type_name[type];
|
||||
if (type < ARRAY_SIZE(type_name))
|
||||
return type_name[type];
|
||||
else
|
||||
return "(unknown)";
|
||||
#else
|
||||
return "(unknown)";
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue