mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
component/bt:fixed the write ccc crash bug error
This commit is contained in:
parent
7eaf1c76dc
commit
abf87b000d
@ -597,11 +597,14 @@ UINT16 gatts_add_char_descr (tGATT_SVC_DB *p_db, tGATT_PERM perm,
|
|||||||
}
|
}
|
||||||
p_char_dscptr->p_value->attr_val.attr_len = attr_val->attr_len;
|
p_char_dscptr->p_value->attr_val.attr_len = attr_val->attr_len;
|
||||||
p_char_dscptr->p_value->attr_val.attr_max_len = attr_val->attr_max_len;
|
p_char_dscptr->p_value->attr_val.attr_max_len = attr_val->attr_max_len;
|
||||||
if (attr_val->attr_val != NULL) {
|
if (attr_val->attr_max_len != 0) {
|
||||||
p_char_dscptr->p_value->attr_val.attr_val = GKI_getbuf(attr_val->attr_max_len);
|
p_char_dscptr->p_value->attr_val.attr_val = GKI_getbuf(attr_val->attr_max_len);
|
||||||
if (p_char_dscptr->p_value->attr_val.attr_val != NULL) {
|
if (p_char_dscptr->p_value->attr_val.attr_val != NULL) {
|
||||||
memset(p_char_dscptr->p_value->attr_val.attr_val, 0, attr_val->attr_max_len);
|
memset(p_char_dscptr->p_value->attr_val.attr_val, 0, attr_val->attr_max_len);
|
||||||
memcpy(p_char_dscptr->p_value->attr_val.attr_val, attr_val->attr_val, attr_val->attr_len);
|
if(attr_val->attr_val != NULL) {
|
||||||
|
memcpy(p_char_dscptr->p_value->attr_val.attr_val,
|
||||||
|
attr_val->attr_val, attr_val->attr_len);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -873,7 +876,7 @@ tGATT_STATUS gatts_write_attr_value_by_handle(tGATT_SVC_DB *p_db,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (p_attr->p_value != NULL && (p_attr->p_value->attr_val.attr_max_len >=
|
if (p_attr->p_value != NULL && (p_attr->p_value->attr_val.attr_max_len >=
|
||||||
offset + len)) {
|
offset + len) && p_attr->p_value->attr_val.attr_val != NULL) {
|
||||||
memcpy(p_attr->p_value->attr_val.attr_val + offset, p_value, len);
|
memcpy(p_attr->p_value->attr_val.attr_val + offset, p_value, len);
|
||||||
p_attr->p_value->attr_val.attr_len = len + offset;
|
p_attr->p_value->attr_val.attr_len = len + offset;
|
||||||
return GATT_SUCCESS;
|
return GATT_SUCCESS;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user