Skip to content

Commit

Permalink
send: Reject content format other than SenML
Browse files Browse the repository at this point in the history
Allow only SenML-JSON or SenML-CBOR content format for LWM2M 1.1 send
requests.
  • Loading branch information
mlasch committed Jun 21, 2024
1 parent 50e85c8 commit ac5bdb5
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions core/reporting.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit ac5bdb5

Please sign in to comment.