Skip to content

Commit d528513

Browse files
committed
[Fix] Initialize all fields in p_parse_packet structure in begin_parse_dxl_packet function
1 parent 5b256b7 commit d528513

1 file changed

Lines changed: 20 additions & 2 deletions

File tree

src/dxl_c/protocol.cpp

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,10 +341,28 @@ DXLLibErrorCode_t begin_parse_dxl_packet(InfoToParseDXLPacket_t* p_parse_packet,
341341
}
342342

343343
p_parse_packet->protocol_ver = protocol_ver;
344+
p_parse_packet->header[0] = 0;
345+
p_parse_packet->header[1] = 0;
346+
p_parse_packet->header[2] = 0;
347+
p_parse_packet->header_cnt = 0;
348+
p_parse_packet->id = 0;
349+
p_parse_packet->inst_idx = 0;
350+
p_parse_packet->err_idx = 0;
344351
p_parse_packet->p_param_buf = p_param_buf;
345352
p_parse_packet->param_buf_capacity = param_buf_capacity;
346-
// p_parse_packet->recv_param_len = 0;
347-
// p_parse_packet->parse_state = 0;
353+
p_parse_packet->recv_param_len = 0;
354+
p_parse_packet->packet_len = 0;
355+
p_parse_packet->calculated_crc = 0;
356+
p_parse_packet->recv_crc = 0;
357+
p_parse_packet->calculated_check_sum = 0;
358+
p_parse_packet->recv_check_sum = 0;
359+
p_parse_packet->reserved = 0;
360+
p_parse_packet->parse_state = 0;
361+
p_parse_packet->xel_count = 0;
362+
p_parse_packet->xel_index = 0;
363+
p_parse_packet->buf_index = 0;
364+
p_parse_packet->param_length = 0;
365+
p_parse_packet->fast_param_state = 0;
348366
p_parse_packet->is_init = true;
349367

350368
return DXL_LIB_OK;

0 commit comments

Comments
 (0)