option.[ch]: Fix "warning: ISO C++ forbids flexible array member 'data' "

This commit is contained in:
Jon Shallow committed 2018-05-22 10:42:13 +01:00
1 parent a2d263356e
commit 856236dc6c
2 files changed
+2 -1

No files matched your search

+1 -1
View File
@@ -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;
/**
+1
View File
@@ -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");