diff options
| author | Guilherme S. Salustiano <[email protected]> | 2024-02-10 08:58:31 +0100 |
|---|---|---|
| committer | Guilherme S. Salustiano <[email protected]> | 2024-02-10 08:58:31 +0100 |
| commit | fdb15b205424e71107f18b43553d43691f3d8fb7 (patch) | |
| tree | a8b271ede3d3157c47f3349f8d8593099da00e1d | |
| parent | 40282c2666f8b8bda5785b30a62ab352ff8e7498 (diff) | |
add comments about buffer unsound
| -rw-r--r-- | embassy-nrf/src/radio/ble.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/embassy-nrf/src/radio/ble.rs b/embassy-nrf/src/radio/ble.rs index 7718cfe14..ba9ac5f2e 100644 --- a/embassy-nrf/src/radio/ble.rs +++ b/embassy-nrf/src/radio/ble.rs | |||
| @@ -334,6 +334,8 @@ impl<'d, T: Instance> Radio<'d, T> { | |||
| 334 | } | 334 | } |
| 335 | 335 | ||
| 336 | /// Send packet | 336 | /// Send packet |
| 337 | /// If the length byte in the package is greater than the buffer length | ||
| 338 | /// the radio will read memory out of the buffer bounds | ||
| 337 | pub async fn transmit(&mut self, buffer: &[u8]) -> Result<(), Error> { | 339 | pub async fn transmit(&mut self, buffer: &[u8]) -> Result<(), Error> { |
| 338 | self.set_buffer(buffer)?; | 340 | self.set_buffer(buffer)?; |
| 339 | 341 | ||
| @@ -349,6 +351,8 @@ impl<'d, T: Instance> Radio<'d, T> { | |||
| 349 | } | 351 | } |
| 350 | 352 | ||
| 351 | /// Receive packet | 353 | /// Receive packet |
| 354 | /// If the length byte in the received package is greater than the buffer length | ||
| 355 | /// the radio will write memory out of the buffer bounds | ||
| 352 | pub async fn receive(&mut self, buffer: &mut [u8]) -> Result<(), Error> { | 356 | pub async fn receive(&mut self, buffer: &mut [u8]) -> Result<(), Error> { |
| 353 | self.set_buffer(buffer)?; | 357 | self.set_buffer(buffer)?; |
| 354 | 358 | ||
