From da790686f337d15f35ab22659714390aed50be78 Mon Sep 17 00:00:00 2001 From: Teufelchen1 Date: Mon, 15 Apr 2024 12:33:12 +0200 Subject: [PATCH] ble/skald: Always enforce URL length check Co-authored-by: benpicco --- sys/net/ble/skald/skald_eddystone.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/net/ble/skald/skald_eddystone.c b/sys/net/ble/skald/skald_eddystone.c index 2f2a53793cb1..bfc7f86b75c2 100644 --- a/sys/net/ble/skald/skald_eddystone.c +++ b/sys/net/ble/skald/skald_eddystone.c @@ -96,7 +96,10 @@ void skald_eddystone_url_adv(skald_ctx_t *ctx, { assert(url && ctx); size_t len = strlen(url); - assert(len <= (NETDEV_BLE_PDU_MAXLEN - (URL_HDR_LEN + PREAMBLE_LEN))); + if (len <= (NETDEV_BLE_PDU_MAXLEN - (URL_HDR_LEN + PREAMBLE_LEN))) { + assert(0); + return; + } eddy_url_t *pdu = (eddy_url_t *)ctx->pkt.pdu; _init_pre(&pdu->pre, EDDYSTONE_URL, (URL_HDR_LEN + len));