You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@mynewt.apache.org by "nychyporuk (via GitHub)" <gi...@apache.org> on 2026/02/09 15:47:01 UTC
[PR] nimble/host: Fix ATT Read By Type and Find By Type Value responses limited by hardcoded buffer sizes [mynewt-nimble]
nychyporuk opened a new pull request, #2171:
URL: https://github.com/apache/mynewt-nimble/pull/2171
**Problem**
The original issue is described here: [https://github.com/apache/mynewt-nimble/issues/1881](https://github.com/apache/mynewt-nimble/issues/1881)
When reading a characteristic by UUID (ATT_READ_BY_TYPE_REQ), attribute values longer than 19 bytes cause the server to respond with BLE_ATT_ERR_UNLIKELY instead of returning the data. Similarly, Find By Type Value (ATT_FIND_BY_TYPE_VALUE_REQ) fails to match attributes with values longer than 16 bytes.
Both issues stem from hardcoded stack buffers passed to ble_att_svr_read_flat(), which returns BLE_ATT_ERR_UNLIKELY when the attribute value exceeds max_len:
- ble_att_svr_build_read_type_rsp: uint8_t buf[19] - caps Read By Type at 19 bytes
- ble_att_svr_fill_type_value: uint8_t buf[16] - caps Find By Type Value comparison at 16 bytes
Per Core Spec v6.0, Section 3.4.4.2, the maximum attribute value in ATT_READ_BY_TYPE_RSP is min(ATT_MTU - 4, 253) octets. The 19-byte limit corresponds to the default MTU of 23 and was never updated to respect the negotiated MTU.
To the application's access_cb, the read appears successful - there is no indication that the client will receive an error.
**Proposed Fix**
Replace both hardcoded flat buffers with a single reusable mbuf per function call. Attribute values are read via ble_att_svr_read() directly into the mbuf, then:
- Read By Type: truncated to min(MTU - 4, 253) per spec and copied into the response. Values longer than the limit are truncated gracefully instead of causing errors.
- Find By Type Value: compared against the request value using os_mbuf_cmpm() (mbuf-to-mbuf), with no size restriction.
- The mbuf is allocated once, reset each iteration with os_mbuf_adj(), and freed in cleanup - no per-iteration allocation overhead. This follows the same pattern already used by ble_att_svr_rx_read and ble_att_svr_build_read_mult_rsp.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: Fix ATT Read By Type and Find By Type Value responses limited by hardcoded buffer sizes [mynewt-nimble]
Posted by "sjanc (via GitHub)" <gi...@apache.org>.
sjanc merged PR #2171:
URL: https://github.com/apache/mynewt-nimble/pull/2171
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: Fix ATT Read By Type and Find By Type Value responses limited by hardcoded buffer sizes [mynewt-nimble]
Posted by "sjanc (via GitHub)" <gi...@apache.org>.
sjanc commented on PR #2171:
URL: https://github.com/apache/mynewt-nimble/pull/2171#issuecomment-3926014893
#AutoPTS run mynewt GATT/SR
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: Fix ATT Read By Type and Find By Type Value responses limited by hardcoded buffer sizes [mynewt-nimble]
Posted by "codecoup-tester (via GitHub)" <gi...@apache.org>.
codecoup-tester commented on PR #2171:
URL: https://github.com/apache/mynewt-nimble/pull/2171#issuecomment-3926025202
Scheduled PR https://github.com/apache/mynewt-nimble/pull/2171#issuecomment-3926014893, board: nrf52, estimated start time: 10:51:20, test case count: 85, estimated duration: 1:23:33<details><summary>Test cases to be run</summary>GATT/SR/GAC/BV-01-C<br>GATT/SR/GAC/BI-01-C<br>GATT/SR/GAD/BV-01-C<br>GATT/SR/GAD/BV-02-C<br>GATT/SR/GAD/BV-03-C<br>GATT/SR/GAD/BV-04-C<br>GATT/SR/GAD/BV-05-C<br>GATT/SR/GAD/BV-06-C<br>GATT/SR/GAR/BV-01-C<br>GATT/SR/GAR/BI-01-C<br>GATT/SR/GAR/BI-02-C<br>GATT/SR/GAR/BI-03-C<br>GATT/SR/GAR/BI-04-C<br>GATT/SR/GAR/BI-05-C<br>GATT/SR/GAR/BV-03-C<br>GATT/SR/GAR/BI-06-C<br>GATT/SR/GAR/BI-07-C<br>GATT/SR/GAR/BI-08-C<br>GATT/SR/GAR/BI-09-C<br>GATT/SR/GAR/BI-10-C<br>GATT/SR/GAR/BI-11-C<br>GATT/SR/GAR/BV-04-C<br>GATT/SR/GAR/BI-12-C<br>GATT/SR/GAR/BI-13-C<br>GATT/SR/GAR/BI-14-C<br>GATT/SR/GAR/BI-15-C<br>GATT/SR/GAR/BI-16-C<br>GATT/SR/GAR/BI-17-C<br>GATT/SR/GAR/BV-05-C<br>GATT/SR/GAR/BI-18-C<br>GATT/SR/GAR/BI-19-C<br>GATT/SR/GAR/BI-20-C<br>GATT/SR/GAR/BI-21-C<br>GATT/S
R/GAR/BI-22-C<br>GATT/SR/GAR/BV-06-C<br>GATT/SR/GAR/BV-07-C<br>GATT/SR/GAR/BV-08-C<br>GATT/SR/GAR/BV-09-C<br>GATT/SR/GAR/BV-11-C<br>GATT/SR/GAR/BV-12-C<br>GATT/SR/GAR/BI-36-C<br>GATT/SR/GAR/BI-38-C<br>GATT/SR/GAR/BI-40-C<br>GATT/SR/GAR/BI-42-C<br>GATT/SR/GAR/BI-44-C<br>GATT/SR/GAR/BI-45-C<br>GATT/SR/GAW/BV-01-C<br>GATT/SR/GAW/BV-03-C<br>GATT/SR/GAW/BI-02-C<br>GATT/SR/GAW/BI-03-C<br>GATT/SR/GAW/BI-04-C<br>GATT/SR/GAW/BI-05-C<br>GATT/SR/GAW/BI-06-C<br>GATT/SR/GAW/BV-05-C<br>GATT/SR/GAW/BI-07-C<br>GATT/SR/GAW/BI-08-C<br>GATT/SR/GAW/BI-09-C<br>GATT/SR/GAW/BI-11-C<br>GATT/SR/GAW/BI-12-C<br>GATT/SR/GAW/BI-13-C<br>GATT/SR/GAW/BV-06-C<br>GATT/SR/GAW/BV-10-C<br>GATT/SR/GAW/BV-11-C<br>GATT/SR/GAW/BV-07-C<br>GATT/SR/GAW/BV-08-C<br>GATT/SR/GAW/BV-09-C<br>GATT/SR/GAW/BI-32-C<br>GATT/SR/GAW/BI-33-C<br>GATT/SR/GAW/BI-39-C<br>GATT/SR/GAW/BV-12-C<br>GATT/SR/GAW/BV-13-C<br>GATT/SR/GAW/BV-14-C<br>GATT/SR/GAN/BV-01-C<br>GATT/SR/GAN/BV-03-C<br>GATT/SR/GAN/BV-02-C<br>GATT/SR/GAI/BV-01-C<br>GATT/SR/GAI/BV
-02-C<br>GATT/SR/GAS/BV-01-C<br>GATT/SR/GAS/BV-03-C<br>GATT/SR/GAS/BV-04-C<br>GATT/SR/GAS/BV-07-C<br>GATT/SR/GAT/BV-01-C<br>GATT/SR/UNS/BI-01-C<br>GATT/SR/UNS/BI-02-C<br>GATT/SR/GPM/BV-05-C</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nimble/host: Fix ATT Read By Type and Find By Type Value responses limited by hardcoded buffer sizes [mynewt-nimble]
Posted by "codecoup-tester (via GitHub)" <gi...@apache.org>.
codecoup-tester commented on PR #2171:
URL: https://github.com/apache/mynewt-nimble/pull/2171#issuecomment-3926796156
AutoPTS Bot results:
<details><summary>Failed tests (8)</summary>GATT GATT/SR/GAN/BV-02-C FATAL ERROR<br>GATT GATT/SR/GAR/BV-12-C INDCSV - ERRATA https://github.com/apache/mynewt-nimble/issues/2002<br>GATT GATT/SR/GAS/BV-04-C FAIL<br>GATT GATT/SR/GAS/BV-07-C FAIL<br>GATT GATT/SR/GAW/BI-11-C FAIL<br>GATT GATT/SR/GAW/BV-12-C INDCSV - ERRATA https://github.com/apache/mynewt-nimble/issues/2002<br>GATT GATT/SR/GAW/BV-13-C INDCSV - ERRATA https://github.com/apache/mynewt-nimble/issues/2002<br>GATT GATT/SR/GAW/BV-14-C INDCSV - ERRATA https://github.com/apache/mynewt-nimble/issues/2002</details>
<details><summary>Successful tests (77)</summary>GATT GATT/SR/GAC/BI-01-C PASS<br>GATT GATT/SR/GAC/BV-01-C PASS<br>GATT GATT/SR/GAD/BV-01-C PASS<br>GATT GATT/SR/GAD/BV-02-C PASS<br>GATT GATT/SR/GAD/BV-03-C PASS<br>GATT GATT/SR/GAD/BV-04-C PASS<br>GATT GATT/SR/GAD/BV-05-C PASS<br>GATT GATT/SR/GAD/BV-06-C PASS<br>GATT GATT/SR/GAI/BV-01-C PASS - ERRATA ES-27410<br>GATT GATT/SR/GAI/BV-02-C PASS<br>GATT GATT/SR/GAN/BV-01-C PASS - ERRATA ES-27410<br>GATT GATT/SR/GAN/BV-03-C PASS - ERRATA Request ID 172623<br>GATT GATT/SR/GAR/BI-01-C PASS<br>GATT GATT/SR/GAR/BI-02-C PASS<br>GATT GATT/SR/GAR/BI-03-C PASS<br>GATT GATT/SR/GAR/BI-04-C PASS<br>GATT GATT/SR/GAR/BI-05-C PASS<br>GATT GATT/SR/GAR/BI-06-C PASS<br>GATT GATT/SR/GAR
/BI-07-C PASS<br>GATT GATT/SR/GAR/BI-08-C PASS<br>GATT GATT/SR/GAR/BI-09-C PASS<br>GATT GATT/SR/GAR/BI-10-C PASS<br>GATT GATT/SR/GAR/BI-11-C PASS<br>GATT GATT/SR/GAR/BI-12-C PASS<br>GATT GATT/SR/GAR/BI-13-C PASS<br>GATT GATT/SR/GAR/BI-14-C PASS<br>GATT GATT/SR/GAR/BI-15-C PASS<br>GATT GATT/SR/GAR/BI-16-C PASS<br>GATT GATT/SR/GAR/BI-17-C PASS<br>GATT GATT/SR/GAR/BI-18-C PASS<br>GATT GATT/SR/GAR/BI-19-C PASS<br>GATT GATT/SR/GAR/BI-20-C PASS<br>GATT GATT/SR/GAR/BI-21-C PASS<br>GATT GATT/SR/GAR/BI-22-C PASS<br>GATT GATT/SR/GAR/BI-36-C PASS (2)<br>GATT GATT/SR/GAR/BI-38-C PASS<br>GATT GATT/SR/GAR/BI-40-C PASS<br>GATT GATT/SR/GAR/BI-42-C PASS<br>GATT GATT/SR/GAR/BI-44-C PASS<br>GATT
GATT/SR/GAR/BI-45-C PASS<br>GATT GATT/SR/GAR/BV-01-C PASS<br>GATT GATT/SR/GAR/BV-03-C PASS<br>GATT GATT/SR/GAR/BV-04-C PASS<br>GATT GATT/SR/GAR/BV-05-C PASS<br>GATT GATT/SR/GAR/BV-06-C PASS<br>GATT GATT/SR/GAR/BV-07-C PASS<br>GATT GATT/SR/GAR/BV-08-C PASS<br>GATT GATT/SR/GAR/BV-09-C PASS<br>GATT GATT/SR/GAR/BV-11-C PASS<br>GATT GATT/SR/GAS/BV-01-C PASS<br>GATT GATT/SR/GAS/BV-03-C PASS<br>GATT GATT/SR/GAT/BV-01-C PASS<br>GATT GATT/SR/GAW/BI-02-C PASS<br>GATT GATT/SR/GAW/BI-03-C PASS<br>GATT GATT/SR/GAW/BI-04-C PASS<br>GATT GATT/SR/GAW/BI-05-C PASS<br>GATT GATT/SR/GAW/BI-06-C PASS<br>GATT GATT/SR/GAW/BI-07-C PASS<br>GATT GATT/SR/GAW/BI-08-C PASS<br>GATT GATT/SR/GAW/BI-09-C P
ASS<br>GATT GATT/SR/GAW/BI-12-C PASS<br>GATT GATT/SR/GAW/BI-13-C PASS<br>GATT GATT/SR/GAW/BI-32-C PASS<br>GATT GATT/SR/GAW/BI-33-C PASS<br>GATT GATT/SR/GAW/BI-39-C PASS<br>GATT GATT/SR/GAW/BV-01-C PASS<br>GATT GATT/SR/GAW/BV-03-C PASS<br>GATT GATT/SR/GAW/BV-05-C PASS<br>GATT GATT/SR/GAW/BV-06-C PASS<br>GATT GATT/SR/GAW/BV-07-C PASS<br>GATT GATT/SR/GAW/BV-08-C PASS<br>GATT GATT/SR/GAW/BV-09-C PASS<br>GATT GATT/SR/GAW/BV-10-C PASS<br>GATT GATT/SR/GAW/BV-11-C PASS<br>GATT GATT/SR/GPM/BV-05-C PASS<br>GATT GATT/SR/UNS/BI-01-C PASS<br>GATT GATT/SR/UNS/BI-02-C PASS</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org