staropram / cantcoap

CoAP implementation that focuses on simplicity by offering a minimal set of functions and straightforward interface.
BSD 2-Clause "Simplified" License
86 stars 38 forks source link

Empty message #32

Open sabor12345 opened 1 year ago

sabor12345 commented 1 year ago

Hi!

I have tested your library and found an issue which i would like to report.

cantcoap

Commit e7bb846

Problem Description

In a coap message, an "empty message" can contain a payload.

Expected behavior

According to RFC7252 (https://www.rfc-editor.org/rfc/rfc7252) :

"An Empty message has the Code field set to 0.00. The Token Length field MUST be set to 0 and bytes of data MUST NOT be present after the Message ID field. If there are any bytes, they MUST be processed as a message format error."

Actual Behavior

An "empty" message with code 0.00 can contain a token, payload, and options.

Some questions:

Can you confirm this behavior? Were you aware of it? Is it intentional or an oversight?

Sincerely Sabor