You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ja...@apache.org on 2026/10/26 14:55:50 UTC
(mynewt-core) 06/08: mgmt/imgmgr: Check hash length in imgr_get_current_hash
This is an automated email from the ASF dual-hosted git repository.
sjanc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git
commit 5a686e4ff9d23763b396c2ba0f3a250e70cadd1a
Author: Szymon Janc <sz...@codecoup.pl>
AuthorDate: Sun Oct 25 23:41:02 2026 +0100
mgmt/imgmgr: Check hash length in imgr_get_current_hash
Requested hash length was not checked against size of image hash, so
larger lengths read past the hash buffer on stack.
Assisted-by: Claude:claude-opus-5-5
---
mgmt/imgmgr/src/imgmgr.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mgmt/imgmgr/src/imgmgr.c b/mgmt/imgmgr/src/imgmgr.c
index a90c4371e..a7f0dcef1 100644
--- a/mgmt/imgmgr/src/imgmgr.c
+++ b/mgmt/imgmgr/src/imgmgr.c
@@ -137,7 +137,7 @@ imgr_get_current_hash(uint8_t *hash, uint16_t hashlen)
uint8_t imghash[IMGMGR_HASH_LEN];
int rc;
- if (!hashlen || !hash) {
+ if (!hashlen || hashlen > IMGMGR_HASH_LEN || !hash) {
return -2;
}