fix udppunch whisper parsing
This commit is contained in:
parent
ab4f322c2d
commit
63f6a41678
1 changed files with 3 additions and 3 deletions
|
@ -1443,9 +1443,9 @@ private:
|
|||
if (!text.empty()) {
|
||||
std::string prefix = "/udppunch ";
|
||||
unsigned int a, b, c, d, ip, port;
|
||||
if (text.size() > prefix.size() && text.rfind(prefix, 0)) {
|
||||
int res = sscanf(text.substr(prefix.size()).c_str(), "%uhh.%uhh.%uhh.%uhh:%d", &d, &c, &b, &a, &port);
|
||||
if (res == 5) {
|
||||
if (text.size() > prefix.size() && text.rfind(prefix, 0) != std::string::npos) {
|
||||
int res = sscanf(text.substr(prefix.size()).c_str(), "%d.%d.%d.%d:%d", &a, &b, &c, &d, &port);
|
||||
if (res == 5 && a < 255 && b < 255 && c < 255 && d < 255 && port > 1024) {
|
||||
ip = a | b << 8 | c << 16 | d << 24;
|
||||
if (NetConnectType == 1 && !GameRunning) { // the server, waiting for clients
|
||||
const CInitMessage_Header message(MessageInit_FromServer, ICMAYT);
|
||||
|
|
Loading…
Add table
Reference in a new issue