Skip to content

fix(cli): parse tempradio args without mutable copy and document timeout cap#1910

Open
robekl wants to merge 1 commit intomeshcore-dev:devfrom
robekl:fix/commoncli-tempradio-no-copy
Open

fix(cli): parse tempradio args without mutable copy and document timeout cap#1910
robekl wants to merge 1 commit intomeshcore-dev:devfrom
robekl:fix/commoncli-tempradio-no-copy

Conversation

@robekl
Copy link

@robekl robekl commented Mar 3, 2026

Summary

This PR hardens tempradio CLI parsing by removing mutable-copy tokenization and parsing arguments directly from the input command string.

It also updates CLI docs to match the new timeout validation range.

What Changed

  • Replaced strcpy(tmp, &command[10]) + parseTextParts(...) for tempradio parsing with a non-mutating parser that reads directly from command + 10.
  • Added dedicated parsing helpers for float and integer fields with separator/trailing-input validation.
  • Kept existing radio parameter range checks and existing success/error reply behavior.
  • Updated docs to state timeout_mins must be 1-32767.

Why

The previous tempradio path copied unbounded user input into a fixed-size internal buffer. This could overflow internal object memory for long CLI input.

The new parser avoids copying entirely for this command path and validates structure explicitly.

Behavior Notes

  • tempradio now requires well-formed comma-separated input and rejects malformed trailing content.
  • timeout_mins is now explicitly capped at 32767 minutes, matching implementation and avoiding unsafe large time conversions.

Validation

  • Reviewed call path and parser behavior in CommonCLI::handleCommand.
  • Confirmed documentation now reflects enforced timeout range.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant