aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2023-10-01 20:18:01 +0200
committerGitHub <[email protected]>2023-10-01 20:18:01 +0200
commit54c54fe37610951ae208f857180efc9fdf45f71c (patch)
tree2cbf2c3e06db7420cf6a8e0e10ed7d2873ef801d
parentCorrectly calculate the total number of RPC ops in the stats page for structu... (diff)
downloadzen-54c54fe37610951ae208f857180efc9fdf45f71c.tar.xz
zen-54c54fe37610951ae208f857180efc9fdf45f71c.zip
Sentry username fix (#435)
* fix trailing null in Sentry username (GetUserName returns the length including NUL terminator)
-rw-r--r--CHANGELOG.md1
-rw-r--r--src/zenserver/zenserver.cpp4
2 files changed, 3 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index aa81e307b..036e563ee 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,7 @@
##
- Bugfix: Correctly calculate the total number of RPC ops in the stats page for structured cache
- Bugfix: Change "chunks" title to "count" for RPC chunk requests in stats page for structured cache
+- Bugfix: Sentry username string no longer includes the trailing NUL
## 0.2.25
- Feature: Add detailed stats on requests and data sizes on a per-bucket level, use parameter `cachestorestats=true` on the `/stats/z$` endpoint to enable
diff --git a/src/zenserver/zenserver.cpp b/src/zenserver/zenserver.cpp
index 40a797c21..fa7694573 100644
--- a/src/zenserver/zenserver.cpp
+++ b/src/zenserver/zenserver.cpp
@@ -1194,9 +1194,9 @@ ZenEntryPoint::Run()
CHAR UserNameBuffer[511 + 1];
DWORD UserNameLength = sizeof(UserNameBuffer) / sizeof(CHAR);
BOOL OK = GetUserNameA(UserNameBuffer, &UserNameLength);
- if (OK)
+ if (OK && UserNameLength)
{
- SentryUserName = std::string(UserNameBuffer, UserNameLength);
+ SentryUserName = std::string(UserNameBuffer, UserNameLength - 1);
}
# endif // ZEN_PLATFORM_WINDOWS
# if (ZEN_PLATFORM_LINUX || ZEN_PLATFORM_MAC)