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

Buffer overflow #2

Open
kevinjwalters opened this issue Dec 5, 2023 · 0 comments
Open

Buffer overflow #2

kevinjwalters opened this issue Dec 5, 2023 · 0 comments

Comments

@kevinjwalters
Copy link

kevinjwalters commented Dec 5, 2023

The count variable is incremented here before the assignment to the array. This means the index values used will be 1 to 512 rather than 0 to 511. The last value of 512 will write beyond the end of the 512 byte array potentially trampling on other things.

if (count < LENGTH) {
count++;
rawData[count] = analogRead(A0)>>2;
}

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