Skip to content

Commit

Permalink
Merge pull request #20559 from benpicco/suit-ENOBUFS
Browse files Browse the repository at this point in the history
sys/suit: return error when URL buffer is too small
  • Loading branch information
benpicco authored Apr 9, 2024
2 parents 3e7bda9 + 68c7bfc commit 5a4d55a
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 5a4d55a

Please sign in to comment.