Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(inputs.modbus): Avoid overflow when calculating with uint16 addresses #15146

Merged
merged 1 commit into from
Apr 12, 2024

Conversation

srebhan
Copy link
Member

@srebhan srebhan commented Apr 11, 2024

Summary

When using addresses at the end of the address range, the batch-limitation calculation might overflow the uint16 range. This PR checks the range now before doing the computation to make sure we do not overflow.

Furthermore, users might provide invalid configuration by using an address at the end of the address-range with a too-large data-type in metric and request configuration-styles. This PR also checks this overflow.
Note: The register style is safe as there you explicitly need to specify the addresses.

Checklist

  • No AI generated code was used in this PR

Related issues

resolves #15138

@telegraf-tiger telegraf-tiger bot added area/modbus fix pr to fix corresponding bug plugin/input 1. Request for new input plugins 2. Issues/PRs that are related to input plugins labels Apr 11, 2024
@srebhan srebhan added the ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review. label Apr 12, 2024
Copy link
Contributor

@powersj powersj left a comment

Choose a reason for hiding this comment

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

Nice catch

@powersj powersj removed their assignment Apr 12, 2024
@DStrand1 DStrand1 merged commit 80891a6 into influxdata:master Apr 12, 2024
26 checks passed
@github-actions github-actions bot added this to the v1.30.2 milestone Apr 12, 2024
powersj pushed a commit that referenced this pull request Apr 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/modbus fix pr to fix corresponding bug plugin/input 1. Request for new input plugins 2. Issues/PRs that are related to input plugins ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

modbus "register" configuration style: registers with 'big' addresses are not read
3 participants