From 9cc4a63bbdea8ac8def90d2038e8ebe7a2ea65ff Mon Sep 17 00:00:00 2001 From: Kareem Date: Wed, 4 Mar 2026 16:10:30 -0700 Subject: [PATCH 1/2] Clarify that wolfBoot_open_image_address expects the passed in img structure to be memset and does not perform the memset itself. --- docs/lib.md | 2 +- src/image.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/lib.md b/docs/lib.md index 7827191562..cf424843b7 100644 --- a/docs/lib.md +++ b/docs/lib.md @@ -15,7 +15,7 @@ is initialized when `wolfBoot_open_image_address()` is called. The signature is: `int wolfBoot_open_image_address(struct wolfBoot_image* img, uint8_t* image)` -where `img` is a pointer to a local (uninitialized) structure of type `wolfBoot_image`, and +where `img` is a pointer to a local (memset but otherwise uninitalized) structure of type `wolfBoot_image`, and `image` is a pointer to where the signed image is mapped in memory, starting from the beginning of the manifest header. diff --git a/src/image.c b/src/image.c index b712114c27..57038fab1e 100644 --- a/src/image.c +++ b/src/image.c @@ -1270,6 +1270,9 @@ uint32_t wolfBoot_image_size(uint8_t *image) * * This function opens an image using the provided image address and initializes * the wolfBoot_image structure. + * Note that this function initializes the members of the wolfBoot_image structure + * but does not initialize the structure itself. It is expected that the wolfBoot_image + * struct is memset to 0 before being passed in, with image->hdr optionally set. * * @param img The pointer to the wolfBoot_image structure to be initialized. * @param image The pointer to the image address. From dd85d1805cbe1a07c3e72d753022504687945889 Mon Sep 17 00:00:00 2001 From: Kareem Date: Wed, 4 Mar 2026 16:20:51 -0700 Subject: [PATCH 2/2] Fix typos --- docs/lib.md | 2 +- src/image.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/lib.md b/docs/lib.md index cf424843b7..a7a4e75c2f 100644 --- a/docs/lib.md +++ b/docs/lib.md @@ -15,7 +15,7 @@ is initialized when `wolfBoot_open_image_address()` is called. The signature is: `int wolfBoot_open_image_address(struct wolfBoot_image* img, uint8_t* image)` -where `img` is a pointer to a local (memset but otherwise uninitalized) structure of type `wolfBoot_image`, and +where `img` is a pointer to a local (memset but otherwise uninitialized) structure of type `wolfBoot_image`, and `image` is a pointer to where the signed image is mapped in memory, starting from the beginning of the manifest header. diff --git a/src/image.c b/src/image.c index 57038fab1e..59890d4912 100644 --- a/src/image.c +++ b/src/image.c @@ -1272,7 +1272,7 @@ uint32_t wolfBoot_image_size(uint8_t *image) * the wolfBoot_image structure. * Note that this function initializes the members of the wolfBoot_image structure * but does not initialize the structure itself. It is expected that the wolfBoot_image - * struct is memset to 0 before being passed in, with image->hdr optionally set. + * struct is memset to 0 before being passed in, with img->hdr optionally set. * * @param img The pointer to the wolfBoot_image structure to be initialized. * @param image The pointer to the image address.