Skip to content

Commit

Permalink
Merge pull request #20563 from maribu/backport/2024.01/suit-ENOBUFS
Browse files Browse the repository at this point in the history
sys/suit: return error when URL buffer is too small [backport 2024.01]
  • Loading branch information
maribu authored Apr 10, 2024
2 parents e8f5882 + 81a5f3a commit 86a8e1d
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 86a8e1d

Please sign in to comment.