espressif / esp-idf

Espressif IoT Development Framework. Official development framework for Espressif SoCs.
Apache License 2.0
13.53k stars 7.26k forks source link

[TW#13761] esp_ble_gatts_set_attr_value truncates value #766

Closed mh-dev closed 7 years ago

mh-dev commented 7 years ago

It took me a few hours to figure out why corrupted/truncated data was transmitted to my client.

The root cause is in https://github.com/espressif/esp-idf/blob/c4edb2a4398aef32822b1f917157e402cc246e64/components/bt/bluedroid/btc/profile/std/gatt/btc_gatts.c#L141 This row performs a downcast from uint16_t to uint8_t. Depending on the passed set value length, the copied length is between 0 and 255 even if its above 255. The fix is just replace uint8_t with uint16_t and you're good to go. This solved the problem for me.

negativekelvin commented 7 years ago

I think you mean L141?

mh-dev commented 7 years ago

Yes I did, I updated the issue

Yulong-espressif commented 7 years ago

@mh-dev Thank you very much for find the IDF bug to us. We will fixed this bug soon on the new version of SDK.

FayeY commented 7 years ago

Hi @mh-dev , please have a try with the latest ESP-IDF. If the issue is still unsolved, please feel free to let us know. Thanks for your interest in ESP32!