From a0cef8077df895b162912bb925698be2cd541e42 Mon Sep 17 00:00:00 2001 From: Brad Arant Date: Sun, 6 Sep 2026 14:12:14 +0000 Subject: [PATCH] Implement MString(void*) - declared but never defined Invisible until this session's ServerCore tls/master merge brought Subscription/SubscriptionManager (which calls it) into the same dependency chain as a real executable for the first time - a static library archive (ar) never checks for unresolved symbols, only the final link of a real binary does, so this went unnoticed for however long it sat declared-only in MString.h. Stores the raw pointer value as the string bytes (pointer-identity comparison, matching how void* aliases are compared everywhere else in this codebase) rather than dereferencing it, since some callers pass arbitrary non-string pointers through this constructor. --- MString.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/MString.cpp b/MString.cpp index 74ced36..301b54c 100644 --- a/MString.cpp +++ b/MString.cpp @@ -27,6 +27,24 @@ namespace coreutils { memcpy(this->data, data, length); cursor = this->data; } + + // Declared alongside MString(const char *data) but never implemented - + // invisible until a real executable actually needed this symbol + // resolved (a static library archive never checks for unresolved + // references, only the final link of a real binary does). Stores the + // raw pointer VALUE itself (not a dereference of it) as the string's + // bytes, matching how void* aliases are compared everywhere else in + // this codebase - by pointer identity, not by string content (e.g. + // TCPServer::getSessionByAlias() and TCPSession::compareAlias() both + // compare void* aliases directly) - so two MStrings built from the + // same alias value compare equal, and one built from an arbitrary + // (possibly non-string, possibly not even null-terminated) alias + // pointer never risks reading past it. + MString::MString(void *alias) { + setSize(sizeof(void *)); + memcpy(this->data, &alias, sizeof(void *)); + cursor = this->data; + } MString::MString(char *data, size_t length) { setSize(length);