Commit Graph
4 Commits
Author SHA1 Message Date
Ben Meadors 81bde47cd4 Move pb string length method and fix linker error 2026-02-08 10:14:40 -06:00
Ben Meadors 370f62a8c9 Refactor test utilities to use portable delay function and include necessary headers 2026-02-08 09:42:05 -06:00
Ben MeadorsandCopilot a43ce34143 Apply suggestion from @Copilot
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-02-08 08:35:20 -06:00
niccellularandClaude Sonnet 4.5 fa5631523e Fix embedded null byte truncation in ATAK strings
Fix bug where UIDs, callsigns, and messages containing embedded null
bytes (0x00) are truncated during compression/decompression. The issue
occurs because strlen() stops at the first null byte, but nanopb char
arrays can contain embedded nulls that are valid data.

This causes Android device UIDs like "ANDROID-e7e455b40002429d" to be
truncated to "ANDROID-e7e455b4" (16 chars instead of 24), breaking
direct messages and contact identification.

The fix adds a pb_string_length() helper that scans for the actual
string length by finding the last non-null character, rather than
stopping at the first null.

Added comprehensive unit tests to prevent regressions:
- Normal strings without embedded nulls
- Strings with embedded null bytes
- Empty strings and edge cases
- Android UID pattern testing
- Multiple embedded nulls scenarios

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-08 08:54:15 -05:00