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

Improve parsing of serial numbers #466

Merged
merged 1 commit into from
Jan 7, 2023

Conversation

tony-iqlusion
Copy link
Member

Checks the length of the data returned when querying the serial number, returning an error if it's longer than 4 bytes, and left-padding with zeroes if it's too short.

This fixes some potential panics due to incorrect slice lengths as were experienced in #465

Checks the length of the data returned when querying the serial number,
returning an error if it's longer than 4 bytes, and left-padding with
zeroes if it's too short.

This fixes some potential panics due to incorrect slice lengths as were
experienced in #465
@tony-iqlusion
Copy link
Member Author

Going to merge this as it resolves the panic in #465 as tested live with the offending device.

I'm not sure if supporting serial numbers serialized with fewer than 4-bytes is actually a good idea or not, but it's certainly preferable to panicking!

@tony-iqlusion tony-iqlusion merged commit f49c617 into main Jan 7, 2023
@tony-iqlusion tony-iqlusion deleted the more-tolerant-serial-number-handling branch January 7, 2023 16:35
@tony-iqlusion tony-iqlusion mentioned this pull request Aug 16, 2023
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