mirror of https://github.com/meshcore-dev/MeshCore
Browse Source
The original implementation accepted dest_size but only used it in the snprintf fast path — manual memcpy assembly could overwrite the buffer if a future caller passed a smaller destination. Additionally, an unsigned underflow on name_budget when prefix_len >= BLE_NAME_MAX_LEN could cascade into massive write lengths. - Clamp all output to min(dest_size-1, BLE_NAME_MAX_LEN) via max_out - Guard against prefix_len >= max_out to prevent unsigned underflow - Validate UTF-8 continuation bytes in utf8CharLen to handle malformed node names (truncated sequences, missing continuations) - Fix backward tail walk to detect malformed sequence at name[0] Co-Authored-By: Claude Opus 4.6 <[email protected]>pull/1801/head
1 changed files with 37 additions and 10 deletions
Loading…
Reference in new issue