Fixed hostname in statistics to properly be in packed binary format.

This commit is contained in:
Thulinma 2014-10-22 16:50:55 +02:00
parent 7e8aaf8ee0
commit a6a6e296bc
3 changed files with 39 additions and 2 deletions

View file

@ -546,12 +546,15 @@ namespace IPC {
///\brief Sets the host of this connection
void statExchange::host(std::string name) {
if (name.size() < 16){
memset(data+32, 0, 16);
}
memcpy(data + 32, name.c_str(), std::min((int)name.size(), 16));
}
///\brief Gets the host of this connection
std::string statExchange::host() {
return std::string(data + 32, std::min((int)strlen(data + 32), 16));
return std::string(data + 32, 16);
}
///\brief Sets the name of the stream this user is viewing