Files
meshtastic_firmware/src
Ben Meadors a41ddec1a7 fix(nrf54l15): don't write past String buffer when a grow fails (#11454)
* fix(nrf54l15): don't write past String buffer when a grow fails

reserve() correctly keeps the old buffer when realloc returns NULL, but
returned void, and assign()/concat() proceeded to memcpy with
n >= _cap anyway - a heap overflow of up to n+1-_cap bytes into
adjacent allocations. On this Zephyr target allocation failure is a
realistic condition, and the result was heap corruption instead of a
clean no-op.

reserve() now reports success and the callers leave the string
unchanged when the grow fails.

* fix(nrf54l15): guard String length arithmetic against wraparound

Per review: reject size requests whose n+1 / _len+n arithmetic would
wrap before they reach the capacity check, and make reserve(0) fail
without calling realloc (realloc(p, 0) would free the buffer and
return NULL, leaving _buf dangling).
2026-08-12 18:17:33 -05:00
..
2026-01-29 05:56:19 -06:00
2026-02-19 07:16:33 -06:00
2026-05-11 11:46:13 -05:00
2026-07-01 19:01:27 -05:00
2026-07-20 11:55:17 +02:00
2023-01-21 21:23:24 +01:00
2026-07-16 18:57:50 -05:00
2026-08-06 14:05:07 +00:00
2026-07-20 11:55:17 +02:00