mirror of
https://github.com/obgm/libcoap.git
synced 2026-11-03 16:36:20 +03:00
coap_session.c: Fix GCC array bounds warning for memcpy
Note assert() added from #1209 has now been removed as not needed by #1628, and if NDEBUG is defined then the assert() would have been a noop anyway.
This commit is contained in:
1 parent
054a55cbd6
commit
bdbcf29bd1
2 files changed
+10
-2
No files matched your search
@@ -307,8 +307,9 @@ coap_pdu_t *coap_pdu_from_pbuf(struct pbuf *pbuf);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* CoAP protocol types
|
||||
*/
|
||||
* CoAP protocol types
|
||||
* Note: coap_layers_coap[] needs updating if extended.
|
||||
*/
|
||||
typedef enum coap_proto_t {
|
||||
COAP_PROTO_NONE = 0,
|
||||
COAP_PROTO_UDP,
|
||||
|
||||
@@ -2096,6 +2096,13 @@ coap_new_endpoint_lkd(coap_context_t *context, const coap_address_t *listen_addr
|
||||
ep->sock.endpoint = ep;
|
||||
assert(proto < COAP_PROTO_LAST);
|
||||
memcpy(&ep->sock.lfunc, coap_layers_coap[proto], sizeof(ep->sock.lfunc));
|
||||
if (proto < COAP_PROTO_LAST) {
|
||||
/*
|
||||
* Should be caught above, but some compilers realize that proto
|
||||
* includes COAP_PROTO_LAST, but there is no table entry for that
|
||||
*/
|
||||
memcpy(&ep->sock.lfunc, coap_layers_coap[proto], sizeof(ep->sock.lfunc));
|
||||
}
|
||||
|
||||
if (COAP_PROTO_NOT_RELIABLE(proto)) {
|
||||
if (!coap_netif_dgrm_listen(ep, listen_addr))
|
||||
|
||||
Reference in new issue
Block a user