Skip to content

Commit d9aab69

Browse files
DaveLacertekartben
authored andcommitted
net: coap: Fix uninitialized variable warning
The variable block_len in function coap_next_block_for_option() can be used uninitialized in case of empty packet in coap_packet_get_payload(). Mute the compiler warning with default value of 0. Signed-off-by: Dave Lacerte <[email protected]>
1 parent c97710c commit d9aab69

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
@@ -1548,7 +1548,7 @@ int coap_next_block_for_option(const struct coap_packet *cpkt,
15481548
enum coap_option_num option)
15491549
{
15501550
int block;
1551-
uint16_t block_len;
1551+
uint16_t block_len = 0;
15521552

15531553
if (option != COAP_OPTION_BLOCK1 && option != COAP_OPTION_BLOCK2) {
15541554
return -EINVAL;

0 commit comments

Comments
 (0)