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: change UART message buffer size to 35 bytes #79
fix: change UART message buffer size to 35 bytes #79
Conversation
The change compiles and the color sensor works with it on x86_64 laptop, hopefully nothing broke. |
8ab3064
to
a267c0a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch!
sensors/ev3_uart_sensor_ld.c
Outdated
@@ -66,7 +66,8 @@ | |||
#endif | |||
|
|||
#define EV3_UART_MAX_DATA_SIZE 32 | |||
#define EV3_UART_MAX_MESSAGE_SIZE (EV3_UART_MAX_DATA_SIZE + 2) | |||
// extra bytes for: main command byte, INFO command byte, final checksum |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please change this to /* */
style comments (it is the Linux kernel style.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
x
Previously, the buffer was only 34 bytes large. This would overflow the buffer if an INFO message with 32 byte payload was received. The problem is the INFO command byte that is not counted to the payload size.
a267c0a
to
4678583
Compare
Thanks! I have now changed the style of the comment. |
Previously, the buffer was only 34 bytes large. This would overflow the buffer if an INFO message with 32 byte payload was received. The problem is the INFO command byte that is not counted to the payload size.
I haven't tested the change yet, but I will try to do so.