CMD_SET_DEFAULT_FLOOD_SCOPE leaves an older, longer name's tail after the new name

Open Beginner friendly
#3,891 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
88/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
c
Domain
embedded-iot

Research direction

Open examples/companion_radio/MyMesh.cpp and read the CMD_SET_DEFAULT_FLOOD_SCOPE handler around line 1993, then compare it with the clear branch around line 2001. Clear the name buffer before copying the shorter name, and check that CMD_GET_DEFAULT_FLOOD_SCOPE around line 2009 no longer returns the previous name’s trailing bytes.

Written by the indexing model from the issue text.

Description

examples/companion_radio/MyMesh.cpp:1993 (companion-v1.18.0, unchanged on main at 75b04ef0, 2026-11-21) copies the new name with strcpy(_prefs.default_scope_name, …). When the new name is shorter than the saved one, the bytes after its NUL keep the old name's tail. CMD_GET_DEFAULT_FLOOD_SCOPE then sends all 31 bytes (MyMesh.cpp:2009), tail included, and it is also saved with the prefs. The radio itself is unaffected, since it reads the name up to the NUL and goes by the key, but a client that doesn't stop at the first NUL shows a joined name: #au set over #au-vic-gipps reads back as #au\0vic-gipps.

Fix: memset(_prefs.default_scope_name, 0, sizeof(_prefs.default_scope_name)); before the strcpy, as the clear branch already does (MyMesh.cpp:2001).

Dominant language
C
Stars
3.9k
Forks
1.5k
Avg merge
2d 20h
Merged PRs (30d)
55

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from meshcore-dev/MeshCore

All issues in meshcore-dev/MeshCore

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.