streamName and connector string data are now properly null-terminated in sharedStats structures, using snprintf.
This commit is contained in:
parent
9c20066925
commit
1dfc22858a
1 changed files with 2 additions and 5 deletions
|
@ -676,10 +676,7 @@ namespace IPC {
|
||||||
if (splitChar != std::string::npos) {
|
if (splitChar != std::string::npos) {
|
||||||
name[splitChar] = '+';
|
name[splitChar] = '+';
|
||||||
}
|
}
|
||||||
memcpy(data + 48, name.c_str(), std::min((int)name.size(), 100));
|
snprintf(data+48, 100, "%s", name.c_str());
|
||||||
if (name.size() < 100){
|
|
||||||
data[48+name.size()] = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
///\brief Gets the name of the stream this user is viewing
|
///\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
|
///\brief Sets the name of the connector through which this user is viewing
|
||||||
void statExchange::connector(std::string name) {
|
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
|
///\brief Gets the name of the connector through which this user is viewing
|
||||||
|
|
Loading…
Add table
Reference in a new issue