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

Use same mechanism to say "no servers found" as to say how many we found #870

Merged
merged 1 commit into from Sep 25, 2016

Conversation

smcv
Copy link
Contributor

@smcv smcv commented Sep 25, 2016

This avoids an array underflow: if no servers were found, we would
write to foundPlayerServerNames[-1], which is undefined behaviour, but
with a reasonable assumption of the stack layout is likely to result
in a write to foundPlayerServerAddresses[MAX - 1].


Underflow found via compiler warnings that are enabled by default in g++ 6.

This avoids an array underflow: if no servers were found, we would
write to foundPlayerServerNames[-1], which is undefined behaviour, but
with a reasonable assumption of the stack layout is likely to result
in a write to foundPlayerServerAddresses[MAX - 1].
@xycaleth xycaleth merged commit b2097da into JACoders:master Sep 25, 2016
@smcv smcv deleted the no-servers-underflow branch September 25, 2016 17:46
eternalcodes pushed a commit to eternalcodes/EternalJK that referenced this pull request Aug 21, 2018
Use same mechanism to say "no servers found" as to say how many we found

Former-commit-id: e583559
eternalcodes pushed a commit to eternalcodes/EternalJK that referenced this pull request Aug 21, 2018
Use same mechanism to say "no servers found" as to say how many we found
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

Successfully merging this pull request may close these issues.

None yet

2 participants