streamName and connector string data are now properly null-terminated in sharedStats structures, using snprintf.

This commit is contained in:
Thulinma 2016-05-18 16:16:42 +02:00
parent 9c20066925
commit 1dfc22858a

View file

@ -676,10 +676,7 @@ namespace IPC {
if (splitChar != std::string::npos) {
name[splitChar] = '+';
}
memcpy(data + 48, name.c_str(), std::min((int)name.size(), 100));
if (name.size() < 100){
data[48+name.size()] = 0;
}
snprintf(data+48, 100, "%s", name.c_str());
}
///\brief Gets the name of the stream this user is viewing
@ -689,7 +686,7 @@ namespace IPC {
///\brief Sets the name of the connector through which this user is viewing
void statExchange::connector(std::string name) {
memcpy(data + 148, name.c_str(), std::min((int)name.size(), 20));
snprintf(data+148, 20, "%s", name.c_str());
}
///\brief Gets the name of the connector through which this user is viewing