Skip to content

fix(keymap): Fix null dereference with debug logging#3406

Merged
petejohanson merged 1 commit into
zmkfirmware:mainfrom
renshyle:fix-sensor-binding-null-deref
Jun 29, 2026
Merged

fix(keymap): Fix null dereference with debug logging#3406
petejohanson merged 1 commit into
zmkfirmware:mainfrom
renshyle:fix-sensor-binding-null-deref

Conversation

@renshyle

Copy link
Copy Markdown
Contributor

If a layer contains fewer sensor bindings than there are sensors declared, binding->behavior_dev is null when a sensor without a behavior in an active layer's bindings is triggered. Fix this by logging a placeholder name if the binding does not exist.

PR check-list

  • Branch has a clean commit history
  • Additional tests are included, if changing behaviors/core code that is testable.
  • Proper Copyright + License headers added to applicable files (Generally, we stick to "The ZMK Contributors" for copyrights to help avoid churn when files get edited)
  • Pre-commit used to check formatting of files, commit messages, etc.
  • Includes any necessary documentation changes.

If a layer contains fewer sensor bindings than there are sensors
declared, binding->behavior_dev is null when a sensor without a behavior
in an active layer's bindings is triggered. Fix this by logging a
placeholder name if the binding does not exist.
@renshyle renshyle requested a review from a team as a code owner June 29, 2026 18:19

@petejohanson petejohanson left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@petejohanson petejohanson merged commit 484a054 into zmkfirmware:main Jun 29, 2026
50 checks passed
@renshyle renshyle deleted the fix-sensor-binding-null-deref branch June 29, 2026 18:54
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.

2 participants