Skip to content

Commit 05ab017

Browse files
jakubwitowskifabiobaltieri
authored andcommitted
net: coap: fix uninitialized usage of option struct
option struct was uninitialized in insert_option() function during encode_options() call when the while loop wasn't executed before. Signed-off-by: Jakub Witowski <jakub.witowski9302@gmail.com>
1 parent 828f5e8 commit 05ab017

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

subsys/net/lib/coap/coap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1395,7 +1395,7 @@ int insert_option(struct coap_packet *cpkt, uint16_t code, const uint8_t *value,
13951395
uint16_t opt_len = 0;
13961396
uint16_t last_opt = 0;
13971397
uint16_t last_offset = cpkt->hdr_len;
1398-
struct coap_option option;
1398+
struct coap_option option = {0};
13991399
int r;
14001400

14011401
while (offset < cpkt->hdr_len + cpkt->opt_len) {

0 commit comments

Comments
 (0)