diff options
| author | Anton Moryakov <[email protected]> | 2025-02-25 16:53:27 +0300 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2025-03-13 14:23:09 -0600 |
| commit | babc6eef2f48970f394816c955a4a7481ce8df80 (patch) | |
| tree | 14e2e9ec8c043918e3901b6c1d29fe75076d8d84 /lib | |
| parent | 628908f849e1a8c99c47aad0df0e4feb7a6b2c9d (diff) | |
lib: rsa: add NULL check for 'algo' in
- Check return value of fdt_getprop for NULL.
- Return -EFAULT if 'algo' property is missing.
- Prevent NULL pointer dereference in strcmp."
Triggers found by static analyzer Svace.
Signed-off-by: Anton Moryakov <[email protected]>
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/rsa/rsa-verify.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/rsa/rsa-verify.c b/lib/rsa/rsa-verify.c index b74aaf86e6d..4a0418a75f1 100644 --- a/lib/rsa/rsa-verify.c +++ b/lib/rsa/rsa-verify.c @@ -449,6 +449,11 @@ static int rsa_verify_with_keynode(struct image_sign_info *info, } algo = fdt_getprop(blob, node, "algo", NULL); + if (!algo) { + debug("%s: Missing 'algo' property\n", __func__); + return -EFAULT; + } + if (strcmp(info->name, algo)) { debug("%s: Wrong algo: have %s, expected %s\n", __func__, info->name, algo); |
