diff options
author | davidebeatrici <davidebeatrici@gmail.com> | 2016-10-23 22:32:08 +0300 |
---|---|---|
committer | davidebeatrici <davidebeatrici@gmail.com> | 2016-10-23 22:32:08 +0300 |
commit | 90bcd40d3920e86598c29d30165f0ab106ae82c2 (patch) | |
tree | 0feb6b25e7af90ed485c66f61108b9219529ff53 /plugins/bf4 | |
parent | 0258d2a1e2cbe76fb5349171235679a2a434e63a (diff) |
plugins: Move NUL terminator to escape function
Diffstat (limited to 'plugins/bf4')
-rw-r--r-- | plugins/bf4/bf4.cpp | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/plugins/bf4/bf4.cpp b/plugins/bf4/bf4.cpp index 0a2e4a052..54d848197 100644 --- a/plugins/bf4/bf4.cpp +++ b/plugins/bf4/bf4.cpp @@ -64,22 +64,19 @@ static int fetch(float *avatar_pos, float *avatar_front, float *avatar_top, floa return true; // This tells Mumble to ignore all vectors. } - serverid[sizeof(serverid)-1] = 0; // NUL terminate queried C strings. We do this to ensure the strings from the game are NUL terminated. They should be already, but we can't take any chances. - escape(serverid); + escape(serverid, sizeof(serverid)); std::ostringstream ocontext; ocontext << " {\"Server ID\": \"" << serverid << "\"}"; // Set context with server ID context = ocontext.str(); std::wostringstream oidentity; oidentity << "{"; - host[sizeof(host)-1] = 0; // NUL terminate queried C strings. We do this to ensure the strings from the game are NUL terminated. They should be already, but we can't take any chances. - escape(host); + escape(host, sizeof(host)); // Only include host (IP:port) if it is not empty and does not include the string "bot" (which means it's a local server). if (strcmp(host, "") != 0 && strstr(host, "bot") == NULL) { oidentity << std::endl << "\"Host\": \"" << host << "\","; } - team[sizeof(team)-1] = 0; // NUL terminate queried C strings. We do this to ensure the strings from the game are NUL terminated. They should be already, but we can't take any chances. std::string Team(team); if (!Team.empty()) { oidentity << std::endl; |