ContactInfo is filled field by field in three places, and none of them
writes every member:
- CMD_ADD_UPDATE_CONTACT, for a contact the node does not know yet
(companion_radio/MyMesh.cpp): the frame's lat/lon/lastmod are optional,
and clients omit them when the contact has no location -- so
gps_lat/gps_lon keep whatever was on the stack.
- DataStore::loadContacts(), and the same loop in simple_secure_chat: the
on-disk record carries no shared_secret/shared_secret_valid, so those
two members are never written. For every contact, on every boot.
shared_secret_valid is the dangerous one. getSharedSecret() computes the
secret only while the flag is false, so a non-zero byte there makes it
hand out an uninitialised buffer as the ECDH shared secret, and DMs to
that contact go out encrypted with garbage -- no error, no log.
populateContactFromAdvert() already memsets for exactly this reason; do
the same at the other three sites.
Found in the field: a room server whose advert carries no location showed
up at 0.255433, 0.0 in two independent companion clients. 255433 is
0x0003E5C9, straight off the stack. Verified the advert itself is clean by
decoding it in a third, unrelated tool.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Filter auto-add of new contacts by hop count (issues #1533, #1546).
Setting is configurable from the companion app via extended
CMD_SET/GET_AUTOADD_CONFIG protocol (0 = no limit, 1-63 = max hops).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* companion: new field in CMD_SET_OTHER_PARAMS, path_hash_mode
* companion: CMD_SEND_SELF_ADVERT, cmd_frame[1] now holds the path hash size (0 = zero hop, 1..3 = flood path hash size)
Add GPS configuration to NodePrefs structure and persist the GPS
enabled state when toggled via UI. This ensures GPS settings are
retained across device restarts.