Skip to content

Commit

Permalink
sys/suit: return error when URL buffer is too small
Browse files Browse the repository at this point in the history
(cherry picked from commit 68c7bfc)
  • Loading branch information
benpicco authored and maribu committed Apr 10, 2024
1 parent e8f5882 commit 81a5f3a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion sys/suit/handlers_command_seq.c
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,10 @@ static int _dtv_fetch(suit_manifest_t *manifest, int key,
return err;
}

assert(manifest->urlbuf && url_len < manifest->urlbuf_len);
if (!manifest->urlbuf || url_len >= manifest->urlbuf_len) {
assert(0);
return SUIT_ERR_NO_MEM;
}
memcpy(manifest->urlbuf, url, url_len);
manifest->urlbuf[url_len] = '\0';

Expand Down

0 comments on commit 81a5f3a

Please sign in to comment.