mirror of
https://github.com/BeamMP/BeamMP-Launcher.git
synced 2025-07-02 16:06:35 +00:00
Security Improvements
This commit is contained in:
parent
e72a1b6213
commit
85813e4f63
@ -14,6 +14,7 @@ extern std::vector<std::string> GlobalInfo;
|
|||||||
void Exit(const std::string& Msg);
|
void Exit(const std::string& Msg);
|
||||||
namespace fs = std::experimental::filesystem;
|
namespace fs = std::experimental::filesystem;
|
||||||
extern std::string UlStatus;
|
extern std::string UlStatus;
|
||||||
|
extern bool TCPTerminate;
|
||||||
extern bool Terminate;
|
extern bool Terminate;
|
||||||
extern bool Confirm;
|
extern bool Confirm;
|
||||||
extern bool MPDEV;
|
extern bool MPDEV;
|
||||||
@ -88,9 +89,18 @@ void SyncResources(SOCKET Sock){
|
|||||||
if(MPDEV)std::cout << "SyncResources Called" << std::endl;
|
if(MPDEV)std::cout << "SyncResources Called" << std::endl;
|
||||||
CheckForDir();
|
CheckForDir();
|
||||||
STCPSend(Sock,"NR" + GlobalInfo.at(0)+":"+GlobalInfo.at(2));
|
STCPSend(Sock,"NR" + GlobalInfo.at(0)+":"+GlobalInfo.at(2));
|
||||||
|
auto Res = STCPRecv(Sock);
|
||||||
|
std::string msg = Res.first;
|
||||||
|
if(msg.size() < 2 || msg.substr(0,2) != "WS"){
|
||||||
|
Terminate = true;
|
||||||
|
TCPTerminate = true;
|
||||||
|
UlStatus = "UlDisconnected";
|
||||||
|
std::cout << "Terminated!" << std::endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
STCPSend(Sock,"SR");
|
STCPSend(Sock,"SR");
|
||||||
char* Res = STCPRecv(Sock).first;
|
Res = STCPRecv(Sock);
|
||||||
if(strlen(Res) == 0){
|
if(strlen(Res.first) == 0){
|
||||||
std::cout << "Didn't Receive any mod from server skipping..." << std::endl;
|
std::cout << "Didn't Receive any mod from server skipping..." << std::endl;
|
||||||
STCPSend(Sock,"Done");
|
STCPSend(Sock,"Done");
|
||||||
UlStatus = "UlDone";
|
UlStatus = "UlDone";
|
||||||
@ -98,7 +108,7 @@ void SyncResources(SOCKET Sock){
|
|||||||
std::cout << "Done!" << std::endl;
|
std::cout << "Done!" << std::endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
std::vector<std::string> list = Split(std::string(Res), ";");
|
std::vector<std::string> list = Split(std::string(Res.first), ";");
|
||||||
std::vector<std::string> FNames(list.begin(), list.begin() + (list.size() / 2));
|
std::vector<std::string> FNames(list.begin(), list.begin() + (list.size() / 2));
|
||||||
std::vector<std::string> FSizes(list.begin() + (list.size() / 2), list.end());
|
std::vector<std::string> FSizes(list.begin() + (list.size() / 2), list.end());
|
||||||
list.clear();
|
list.clear();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user