mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-26 15:28:50 +00:00
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 <ant.v.moryakov@gmail.com>
This commit is contained in:
parent
628908f849
commit
babc6eef2f
1 changed files with 5 additions and 0 deletions
|
@ -449,6 +449,11 @@ static int rsa_verify_with_keynode(struct image_sign_info *info,
|
||||||
}
|
}
|
||||||
|
|
||||||
algo = fdt_getprop(blob, node, "algo", NULL);
|
algo = fdt_getprop(blob, node, "algo", NULL);
|
||||||
|
if (!algo) {
|
||||||
|
debug("%s: Missing 'algo' property\n", __func__);
|
||||||
|
return -EFAULT;
|
||||||
|
}
|
||||||
|
|
||||||
if (strcmp(info->name, algo)) {
|
if (strcmp(info->name, algo)) {
|
||||||
debug("%s: Wrong algo: have %s, expected %s\n", __func__,
|
debug("%s: Wrong algo: have %s, expected %s\n", __func__,
|
||||||
info->name, algo);
|
info->name, algo);
|
||||||
|
|
Loading…
Add table
Reference in a new issue