Skip to content

Commit b221392

Browse files
sandro97gitkartben
authored andcommitted
doc: coap_server: fix msg size
The sizeof operator applied to a pointer to char does not return the number of characters. This leads to the message being cut off. Instead we should use strlen. Signed-off-by: Sandro Scherer <[email protected]>
1 parent 89ba317 commit b221392

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

doc/connectivity/networking/api/coap_server.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ The following is an example of a CoAP resource registered with our service:
100100
101101
/* Append payload */
102102
coap_packet_append_payload_marker(&response);
103-
coap_packet_append_payload(&response, (uint8_t *)msg, sizeof(msg));
103+
coap_packet_append_payload(&response, (uint8_t *)msg, strlen(msg));
104104
105105
/* Send to response back to the client */
106106
return coap_resource_send(resource, &response, addr, addr_len, NULL);

0 commit comments

Comments
 (0)