From e8cfd3a2d18408783511a81bf49727604c3ec183 Mon Sep 17 00:00:00 2001 From: Marc Lasch Date: Thu, 15 Dec 2022 09:41:41 +0100 Subject: [PATCH] send: Reject content format other than SenML Allow only SenML-JSON or SenML-CBOR content format for LWM2M 1.1 send requests. --- core/reporting.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/reporting.c b/core/reporting.c index 03f306ac4..8e55d0ddc 100755 --- a/core/reporting.c +++ b/core/reporting.c @@ -40,6 +40,10 @@ uint8_t reporting_handleSend(lwm2m_context_t *contextP, void *fromSessionH, coap format = utils_convertMediaType(message->content_type); + if (format != LWM2M_CONTENT_SENML_JSON && format != LWM2M_CONTENT_SENML_CBOR) { + return COAP_400_BAD_REQUEST; + } + if (contextP->reportingSendCallback != NULL) { contextP->reportingSendCallback(contextP, clientP->internalID, NULL, message->code, NULL, format, message->payload, message->payload_len, contextP->reportingSendUserData);