mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 03:00:34 +03:00
fix(ble/bluedroid): Use calloc in gatt_server example
(cherry picked from commit e26b60090d)
Co-authored-by: zhanghaipeng <zhanghaipeng@espressif.com>
This commit is contained in:
@@ -282,7 +282,8 @@ void example_write_event_env(esp_gatt_if_t gatts_if, prepare_type_env_t *prepare
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
esp_gatt_rsp_t *gatt_rsp = (esp_gatt_rsp_t *)malloc(sizeof(esp_gatt_rsp_t));
|
// Security fix: Use calloc to ensure memory is zero-initialized
|
||||||
|
esp_gatt_rsp_t *gatt_rsp = (esp_gatt_rsp_t *)calloc(1, sizeof(esp_gatt_rsp_t));
|
||||||
if (gatt_rsp) {
|
if (gatt_rsp) {
|
||||||
gatt_rsp->attr_value.len = param->write.len;
|
gatt_rsp->attr_value.len = param->write.len;
|
||||||
gatt_rsp->attr_value.handle = param->write.handle;
|
gatt_rsp->attr_value.handle = param->write.handle;
|
||||||
|
|||||||
Reference in New Issue
Block a user