Skip to content
This repository has been archived by the owner on Jul 31, 2024. It is now read-only.

Buffer overflow in toggly code sample #126

Closed
loicpoulain opened this issue Aug 28, 2017 · 4 comments
Closed

Buffer overflow in toggly code sample #126

loicpoulain opened this issue Aug 28, 2017 · 4 comments

Comments

@loicpoulain
Copy link
Contributor

In the Linux User Guide for Dragon Board (P22/26):
https://github.com/96boards/documentation/blob/master/ConsumerEdition/DragonBoard-410c/Guides/LinuxUserGuide_DragonBoard.pdf

The toggly src code define MAX_BUF as 10 bytes.
However this define is used to allocate buffers which need more memory in Write_GPIO and Read_GPIO functions. (snprintf).

This leads to stack corruption for the sample but also for users who base their own code on this sample.
https://discuss.96boards.org/t/bus-error-working-with-gpios/2704/6

A quick fix would be to define MAX_BUF as 100.
#define MAX_BUF 100

@Mani-Sadhasivam
Copy link
Member

@loicpoulain Agree with you. Probably that was due to bad coding practice I'd say.

Thanks for pointing out.

@sdrobertw Any way to update the doc?

@fixxxxxxer
Copy link
Collaborator

fixxxxxxer commented Aug 28, 2017

@loicpoulain

This user guide was written by a third party and provided to us by a partner. This is the exact reason why I do not like static documentation as we do no own the raw doc. If you feel like having some doc fun 😃 , it would be really cool to turn that small section of the user guide into an individual doc (markdown) within the DB410c "guides" section.

https://github.com/96boards/documentation/tree/master/ConsumerEdition/DragonBoard-410c/Guides

Feel free to fork, create the new guide, and submit a PR. Much appreciated for noting this!

@loicpoulain
Copy link
Contributor Author

@sdrobertw

I agree, but what about updating the pdf value as a short term fix.
#127

@fixxxxxxer
Copy link
Collaborator

@loicpoulain

I have accepted your PR, can we please close this issue if you feel it has been resolved.

Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants