1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

sys/suit: return error when URL buffer is too small

This commit is contained in:
Benjamin Valentin 2024-04-08 16:33:44 +02:00
parent 43f010c751
commit 68c7bfc20d

View File

@ -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';