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

FreeIMUUtils/CommunicationUtils.cpp should not use %s to buffer in non-ASCII output #21

Closed
drogge opened this issue Sep 29, 2018 · 3 comments

Comments

@drogge
Copy link

drogge commented Sep 29, 2018

The toPrintableArr function used to buffer the IMU data in the 'b' command ends up using the %s printf format to try to add a byte to output buffer. This would cause the byte to be interpreted as a char * and some random amount of garbage will be copied to the buffer. Probably overflowing into adjacent memory.

@zrecore
Copy link

zrecore commented Sep 29, 2018 via email

@drogge
Copy link
Author

drogge commented Sep 29, 2018

I'm not sure that the FemtoCore code is actually able to handle transmitting raw data. In the case of the 'b' command the buffer with the raw data is handed off to _reply which assumes the buffer contains ASCII chars. The calls to sprintf would probably yield unexpected results with raw data.

If you're going to be sending raw data then lots of functions are going to have to not depend on dealing with NULL terminated strings. This include send, broadcast, _networkingSendMessage* and maybe more.

You might want to think about not supporting raw data for now.

@zrecore
Copy link

zrecore commented Sep 29, 2018 via email

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

2 participants