diff --git a/include/zenoh-pico/protocol/definitions/declarations.h b/include/zenoh-pico/protocol/definitions/declarations.h index 66e21add2..b40cb3fc4 100644 --- a/include/zenoh-pico/protocol/definitions/declarations.h +++ b/include/zenoh-pico/protocol/definitions/declarations.h @@ -95,6 +95,8 @@ typedef struct { } _z_undecl_interest_t; _z_undecl_interest_t _z_undecl_interest_null(void); +#define _Z_FLAG_INTEREST_ID (1 << 5) + typedef struct { enum { _Z_DECL_KEXPR, diff --git a/src/protocol/codec/declarations.c b/src/protocol/codec/declarations.c index 824965c2d..bb0806a6a 100644 --- a/src/protocol/codec/declarations.c +++ b/src/protocol/codec/declarations.c @@ -427,9 +427,13 @@ int8_t _z_undecl_interest_decode(_z_undecl_interest_t *decl, _z_zbuf_t *zbf, uin return _z_undecl_trivial_decode(zbf, &decl->_ext_keyexpr, &decl->_id, header); } int8_t _z_declaration_decode(_z_declaration_t *decl, _z_zbuf_t *zbf) { - int8_t ret; uint8_t header; _Z_RETURN_IF_ERR(_z_uint8_decode(&header, zbf)); + if (_Z_HAS_FLAG(header, _Z_FLAG_INTEREST_ID)) { + return _Z_ERR_MESSAGE_FLAG_UNEXPECTED; + } + + int8_t ret; switch (_Z_MID(header)) { case _Z_DECL_KEXPR_MID: { decl->_tag = _Z_DECL_KEXPR;