Skip to content

Commit

Permalink
suit: replace SUIT_URL_MAX with CONFIG_SOCK_URLPATH_MAXLEN
Browse files Browse the repository at this point in the history
  • Loading branch information
benpicco committed May 25, 2022
1 parent 90f4945 commit 974fb3c
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 13 deletions.
7 changes: 0 additions & 7 deletions sys/include/suit.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,6 @@ extern "C" {
#define CONFIG_SUIT_COMPONENT_MAX_NAME_LEN (32U)
#endif

/**
* @brief Maximum length of a SUIT resource URL
*/
#ifndef SUIT_URL_MAX
#define SUIT_URL_MAX 128
#endif

/**
* @brief Current SUIT serialization format version
*
Expand Down
2 changes: 1 addition & 1 deletion sys/suit/transport/coap.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ static ssize_t _trigger_handler(coap_pkt_t *pkt, uint8_t *buf, size_t len,
unsigned code;
size_t payload_len = pkt->payload_len;
if (payload_len) {
if (payload_len >= SUIT_URL_MAX) {
if (payload_len >= CONFIG_SOCK_URLPATH_MAXLEN) {
code = COAP_CODE_REQUEST_ENTITY_TOO_LARGE;
}
else {
Expand Down
4 changes: 2 additions & 2 deletions sys/suit/transport/worker.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
#define SUIT_MSG_TRIGGER 0x12345

static char _stack[SUIT_WORKER_STACKSIZE];
static char _url[SUIT_URL_MAX];
static char _url[CONFIG_SOCK_URLPATH_MAXLEN];
static uint8_t _manifest_buf[SUIT_MANIFEST_BUFSIZE];

static kernel_pid_t _suit_worker_pid;
Expand Down Expand Up @@ -111,7 +111,7 @@ static void _suit_handle_url(const char *url)
memset(&manifest, 0, sizeof(manifest));

manifest.urlbuf = _url;
manifest.urlbuf_len = SUIT_URL_MAX;
manifest.urlbuf_len = CONFIG_SOCK_URLPATH_MAXLEN;

int res;
if ((res = suit_parse(&manifest, _manifest_buf, size)) != SUIT_OK) {
Expand Down
5 changes: 2 additions & 3 deletions tests/suit_manifest/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@

#include TEST_MANIFEST_INCLUDE(file1.bin.h)
#include TEST_MANIFEST_INCLUDE(file2.bin.h)
#define SUIT_URL_MAX 128

typedef struct {
const unsigned char *data;
Expand Down Expand Up @@ -73,13 +72,13 @@ const size_t num_payloads = ARRAY_SIZE(payloads);
static int test_suit_manifest(const unsigned char *manifest_bin,
size_t manifest_bin_len)
{
char _url[SUIT_URL_MAX];
char _url[CONFIG_SOCK_URLPATH_MAXLEN];
suit_manifest_t manifest;

memset(&manifest, 0, sizeof(manifest));

manifest.urlbuf = _url;
manifest.urlbuf_len = SUIT_URL_MAX;
manifest.urlbuf_len = CONFIG_SOCK_URLPATH_MAXLEN;

int res;
if ((res =
Expand Down

0 comments on commit 974fb3c

Please sign in to comment.