Skip to content

Commit ffed417

Browse files
committed
Merge branch 'bugfix/fix_a_crash_issue_if_uses_sdio_intf_v3.2.0.0' into 'release/v3.2.0.0'
fix(FCS-1612): Fixed a heap corruption issue when using the sdio interface (v3.2.0.0) See merge request application/esp-at!1682
2 parents b3a0755 + 6b2effc commit ffed417

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

main/interface/sdio/at_sdio_task.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -136,13 +136,13 @@ static int32_t at_sdio_read_data(uint8_t* data, int32_t len)
136136
break;
137137
}
138138

139-
esp_at_sdio_list_t* p_list = pHead;
140-
141-
if (len < p_list->left_len) {
142-
memcpy(data + copy_len, p_list->pbuf + p_list->pos, len);
143-
p_list->pos += len;
144-
p_list->left_len -= len;
145-
copy_len += len;
139+
esp_at_sdio_list_t *p_list = pHead;
140+
uint32_t to_read_len = len - copy_len;
141+
if (to_read_len < p_list->left_len) {
142+
memcpy(data + copy_len, p_list->pbuf + p_list->pos, to_read_len);
143+
p_list->pos += to_read_len;
144+
p_list->left_len -= to_read_len;
145+
copy_len += to_read_len;
146146
} else {
147147
memcpy(data + copy_len, p_list->pbuf + p_list->pos, p_list->left_len);
148148
p_list->pos += p_list->left_len;

0 commit comments

Comments
 (0)