Skip to content

Commit

Permalink
retention: blinfo: Fix issue with crash writing to keys
Browse files Browse the repository at this point in the history
Fixes an issue which would cause a fault if someone attempted
to write to the (non-writable) blinfo keys

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
  • Loading branch information
nordicjm authored and fabiobaltieri committed Oct 12, 2023
1 parent 04a0cf7 commit 65bb96f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions subsys/retention/blinfo_mcuboot.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,12 @@ int blinfo_lookup(uint16_t key, char *val, int val_len_max)

#if defined(CONFIG_RETENTION_BOOTLOADER_INFO_OUTPUT_SETTINGS)
static int blinfo_handle_get(const char *name, char *val, int val_len_max);
static int blinfo_handle_set(const char *name, size_t len, settings_read_cb read_cb, void *cb_arg);

static struct settings_handler blinfo_handler = {
.name = "blinfo",
.h_get = blinfo_handle_get,
.h_set = blinfo_handle_set,
};

static int blinfo_handle_get(const char *name, char *val, int val_len_max)
Expand Down Expand Up @@ -110,6 +112,11 @@ static int blinfo_handle_get(const char *name, char *val, int val_len_max)

return blinfo_lookup(index, val, val_len_max);
}

static int blinfo_handle_set(const char *name, size_t len, settings_read_cb read_cb, void *cb_arg)
{
return -ENOTSUP;
}
#endif

static int blinfo_init(void)
Expand Down

0 comments on commit 65bb96f

Please sign in to comment.