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

String lenghts may be too short: causing failed deserialization #4

Open
gauteh opened this issue Oct 12, 2023 · 0 comments
Open

String lenghts may be too short: causing failed deserialization #4

gauteh opened this issue Oct 12, 2023 · 0 comments

Comments

@gauteh
Copy link
Owner

gauteh commented Oct 12, 2023

The string length for various response structs may be too short in some cases. The heapless Strings will fail to deserialize if they don't fit into the reserved space. Recently this caused the card.location request to fail, because the location as returned by blues was too long for the length. Even though the location field was not used, and only the GPS coordinates were used. This was triggered when the device was located somewhere with a long name. The fix here was just to make the field much longer:

But it is still not very robust. And there might be other places where this is a problem. The best would be if there could be some serde directive to make heapless truncate the string, rather than error: rust-embedded/heapless#379 . Alternatively using an allocator might also make things more robust, but maybe unpredictable and vulnerable to bogus long strings from the notecard.

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

No branches or pull requests

1 participant