java-topology/defects/spring-rts-0002/patch/spring-rts-0002.patch
russell@unturf.com d3746b98c9 spring-rts: 2 defects (CWE-407 + CWE-312), MOAD 0002-0005 CLEAN
spring-rts-0001: CWeapon::HasIncomingProjectile std::find on vector O(I)
  called from InterceptHandler::Update() O(W*P) nested loop = O(W*P*I).
  Fix: std::unordered_set<int> for O(1) lookup. 3x measured at W=10 P=200 I=100.

spring-rts-0002: GameServer logs passwords verbatim (CWE-312).
  Two LOG() calls in adduser command handler emit pwd.c_str() to log output.
  Fix: remove password values from log format strings.

MOAD-0002 (intertangle): pervasive global state (gs, gu, handlers) but
  architectural, not patchable per-defect.
MOAD-0003 (leaked context): thread_local in Threading.cpp is infrastructure,
  not request-scoped identity. CLEAN.
MOAD-0004: spring-rts-0002 covers this.
MOAD-0005 (thundering herd): simulation is single-threaded for determinism.
  No unsynchronized cache patterns. CLEAN.
2026-03-31 12:43:28 -04:00

17 lines
694 B
Diff

--- a/rts/Net/GameServer.cpp
+++ b/rts/Net/GameServer.cpp
@@ -2487,10 +2487,10 @@
if (playerIter != players.end()) {
playerIter->SetValue("password", pwd);
- LOG("[%s] changed password for client \"%s\" to \"%s\"", __func__, name.c_str(), pwd.c_str());
+ LOG("[%s] changed password for client \"%s\"", __func__, name.c_str());
} else {
AddAdditionalUser(name, pwd, false, spectator, team);
- LOG("[%s] added %s \"%s\" with password \"%s\" to team %d",
- __func__, (spectator? "spectator": "player"), name.c_str(), pwd.c_str(), team
+ LOG("[%s] added %s \"%s\" to team %d",
+ __func__, (spectator? "spectator": "player"), name.c_str(), team
);
}