mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 11:45:36 +02:00
fix memory overwrite in domain server
This commit is contained in:
parent
615f04982c
commit
0cea1e80ff
2 changed files with 2 additions and 1 deletions
|
@ -78,7 +78,7 @@ int addAgent(uint32_t ip, in_port_t port, char *private_ip, unsigned short priva
|
|||
agents[i].active = true;
|
||||
agents[i].public_sin_addr.s_addr = ip;
|
||||
agents[i].public_port = port;
|
||||
agents[i].private_addr = private_ip;
|
||||
strcpy(agents[i].private_addr, private_ip);
|
||||
agents[i].private_port = private_port;
|
||||
agents[i].agentType = agentType;
|
||||
gettimeofday(&agents[i].time, NULL);
|
||||
|
|
|
@ -62,6 +62,7 @@ int update_agents(char * data, int length) {
|
|||
spot = packet.find_first_of (",", 0);
|
||||
while (spot != std::string::npos) {
|
||||
std::string thisAgent = packet.substr(start_spot, spot-start_spot);
|
||||
std::cout << "RAW: " << thisAgent << "\n";
|
||||
sscanf(thisAgent.c_str(), "%c %s %hd %s %hd", &agentType, public_address, &public_port, private_address, &private_port);
|
||||
add_agent(public_address, public_port, private_address, private_port, agentType);
|
||||
numAgents++;
|
||||
|
|
Loading…
Reference in a new issue