Sitelet https://github.com/betaflight/betaflight/pull/14952
Skip to content

MSP: validate servo mixer targetChannel and inputSource bounds in MSP_SET_SERVO_MIX_RULE - #14952

Merged
blckmn merged 1 commit into
betaflight:masterfrom
blckmn:msp_servo_validation
Mar 7, 2026
Merged

blckmn merged 1 commit into
betaflight:masterfrom
blckmn:msp_servo_validation

Conversation

@blckmn

@blckmn blckmn commented Feb 28, 2026 •

Copy link
Copy Markdown
Member

Summary by CodeRabbit

Bug Fixes

  • Enhanced input validation for servo mixer configuration with added bounds checking on channel and input values during both configuration updates and read operations, preventing invalid values from being applied and improving system stability.

@blckmn blckmn self-assigned this Feb 28, 2026
@github-actions

Copy link
Copy Markdown

Do you want to test this code? You can flash it directly from the Betaflight App:

  • Simply put #14952 (this pull request number) in the Select commit field in the Firmware Flasher tab (you need to Enable expert mode, Show release candidates and Development).

WARNING: It may be unstable. Use only for testing!

@coderabbitai

coderabbitai Bot commented Feb 28, 2026 •

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 49a0393 and 2932a33.

📒 Files selected for processing (1)
  • src/main/msp/msp.c

Walkthrough

This change strengthens input validation in servo mixer rule processing by adding bounds checking for targetChannel and inputSource fields in both MSP set and get operations, validating against MAX_SUPPORTED_SERVOS and INPUT_SOURCE_COUNT respectively, returning errors on invalid values.

Changes

Cohort / File(s) Summary
Servo Mixer Validation
src/main/msp/msp.c
Added bounds checking for servo mixer rule fields (targetChannel, inputSource) in both inbound (set) and outbound (get) MSP paths, with early error returns on invalid values.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The pull request lacks any description from the author, which violates the repository's guidelines that expect pull request details and context. Add a detailed description explaining the validation changes, why bounds checking is necessary, and any related issue numbers (e.g., 'Fixes #...' if applicable).
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: adding bounds validation for servo mixer targetChannel and inputSource in the MSP_SET_SERVO_MIX_RULE handler.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@haslinghuis haslinghuis moved this to Improvements in 2026.6.0 Feb 28, 2026
@haslinghuis haslinghuis added this to the 2026.6 milestone Feb 28, 2026
@blckmn
blckmn merged commit 035e78e into betaflight:master Mar 7, 2026
35 checks passed
@github-project-automation github-project-automation Bot moved this from Improvements to Done in 2026.6.0 Mar 7, 2026
@blckmn
blckmn deleted the msp_servo_validation branch March 7, 2026 20:12
x4FF3 pushed a commit to openwch/betaflight that referenced this pull request Apr 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants