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

Fix xtreme8000#96 error when starting client with aos version in url #189

Open
wants to merge 3 commits into
base: standalone
Choose a base branch
from

Conversation

dany-on-demand
Copy link
Contributor

The reason this happens is because network_identifier_split at some point got support for "255.255.255.255" ipv4 format, and if you have the suffix it thinks that it's parsing that. This hotfix works in either case (tested). The information about whether the server is .75 or .76 is not needed as it is already handled heuristically in network_connect and read_PacketWorldUpdate

forked-from-1kasper added a commit to forked-from-1kasper/tigerspades that referenced this pull request Jan 8, 2024
@xtreme8000
Copy link
Owner

  • There will be out of bounds accesses if strlen(str) is less than 5.
  • I don't see any need to return str

@dany-on-demand
Copy link
Contributor Author

forked-from-1kasper/tigerspades@247f2ca also has a different solution, but like I said as far as I know this is entirely pointless, distinguishing versions at this point is unnecessary and doesn't do anything

remove the "removesuffix" and use less straight forward but more c-like logic. functionality is the same, but it also handles cases where "ip" portion is longer than 32 (like if someone accidentally puts a domain there, which does remind me maybe that should be a feature lol)
}
} else {
// parse port, also ignore anything past another ':' (e.g. version info)
int next_colon = strchr(port_start + 1, ':');
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is next_colon of type int even though strchr returns char*

} else {
// parse port, also ignore anything past another ':' (e.g. version info)
int next_colon = strchr(port_start + 1, ':');
*port_out = strtoul(port_start + 1, next_colon, 10);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

next_colon should be passed as a char** pointer, where strtoul can write the first invalid char pos to, HOWEVER we don't actually need it here, and can pass NULL instead, thus don't even need it in the first place

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this PR even do anything different to the original code, except the additional ip length check???

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