diff --git a/include/coap/option.h b/include/coap/option.h index 5ad3152e..83b56b25 100644 --- a/include/coap/option.h +++ b/include/coap/option.h @@ -429,7 +429,7 @@ typedef struct coap_optlist_t { struct coap_optlist_t *next; /**< next entry in the optlist chain */ uint16_t number; /**< the option number (no delta coding) */ size_t length; /**< the option value length */ - uint8_t data[]; /**< the option data */ + uint8_t *data; /**< the option data */ } coap_optlist_t; /** diff --git a/src/option.c b/src/option.c index 865a2f17..1ef269d6 100644 --- a/src/option.c +++ b/src/option.c @@ -552,6 +552,7 @@ coap_new_optlist(uint16_t number, if (node) { node->number = number; node->length = length; + node->data = (uint8_t *)&node[1]; memcpy(node->data, data, length); } else { coap_log(LOG_WARNING, "coap_new_optlist: malloc failure\n");