diff options
| author | Maks Mishin <[email protected]> | 2024-03-01 01:32:11 +0300 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2024-03-07 07:59:17 -0500 |
| commit | 606867c849b48bf10c16877507480269497e8afd (patch) | |
| tree | a237b7837e1664ac0fbd91f35700d058605ff061 | |
| parent | 91febe80c9f2434170c6c2e866942c75372aed75 (diff) | |
autoboot: Add check for result of malloc_cache_aligned()
Return value of a function 'malloc_cache_aligned'
is dereferenced at autoboot.c:207 without checking for NULL,
but it is usually checked for this function.
Found by RASU JSC.
Signed-off-by: Maks Mishin <[email protected]>
| -rw-r--r-- | common/autoboot.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/common/autoboot.c b/common/autoboot.c index 5d331991c19..6f0aeae6bf3 100644 --- a/common/autoboot.c +++ b/common/autoboot.c @@ -167,6 +167,9 @@ static int passwd_abort_sha256(uint64_t etime) sha_env_str = AUTOBOOT_STOP_STR_SHA256; presskey = malloc_cache_aligned(DELAY_STOP_STR_MAX_LENGTH); + if (!presskey) + return -ENOMEM; + c = strstr(sha_env_str, ":"); if (c && (c - sha_env_str < DELAY_STOP_STR_MAX_LENGTH)) { /* preload presskey with salt */ |
