This is most odd, because it doesn't occur on all machines I try it on--at least not in this particular way. The GDB output is below:
Program received signal SIGSEGV, Segmentation fault.
0x0024dc4e in _int_malloc () from /lib/libc.so.6
(gdb) where
#0 0x0024dc4e in _int_malloc () from /lib/libc.so.6
#1 0x0024f492 in malloc () from /lib/libc.so.6
#2 0x001b6bf6 in operator new () from /usr/lib/libstdc++.so.6
#3 0x00143e80 in __gnu_cxx::__pool<true>::_M_reclaim_block ()
from /usr/lib/libstdc++.so.6
#4 0x0018e27d in std::string::_Rep::_S_create () from /usr/lib/libstdc++.so.6
#5 0x001901c1 in std::string::_M_mutate () from /usr/lib/libstdc++.so.6
#6 0x001903f0 in std::string::_M_replace_safe () from /usr/lib/libstdc++.so.6
#7 0x0019267e in std::string::replace () from /usr/lib/libstdc++.so.6
#8 0x00192c9d in std::string::replace () from /usr/lib/libstdc++.so.6
#9 0x0808cc63 in find_and_replace (source=@0xbfeeed30, find=@0xbfeeeb6c,
replace=@0xbfeeeb64) at utils.cpp:170
#10 0x080803db in Socket::Colorize (this=0x99bd510, txt=@0xbfeeed30)
at socket.cpp:210
#11 0x08082706 in Socket::Write (this=0x99bd510, txt=@0xbfeeed60)
at socket.cpp:159
#12 0x0808c7c2 in send_to_char (ch=0x99bb520, text=@0xbfeeedfc) at utils.cpp:21
#13 0x0805b855 in do_who (ch=0x99bb520, arg=@0xbfeeee84, special_command=0)
at actions_informative.cpp:111
#14 0x08061025 in command_interpreter (ch=0x99bb520, text=@0xbfeef39c)
at commandinterpreter.cpp:118
#15 0x08085ceb in socket_state_handler (pSocket=0x99bd510)
at statehandler.cpp:53
---Type <return> to continue, or q <return> to quit---
#16 0x08076449 in main (argc=2, argv=0xbfeef884) at main.cpp:99
I'm sure that it's obvious enough, but I bolded where my code ends and the <string> code begins.
find_and_replace is a wrapper for the std::string replace function (I was far, far too lazy to be good and use the proper code for the std::string class more than once, and this was easier).
Socket::Colorize is (in a hideously ugly way, let's not kid ourselves here) a battery of find_and_replace statements that replaces my defined color codes with the telnet ANSI color sequences (so that "{B" is translated into the ANSI code for bold blue--this is a MUD codebase). Socket::Write puts whatever string is passed to it into an output buffer for flushing later.
do_who is where the string is compiled. It looks something like the following (though with ANSI sequences that I didn't show).
[PK?][ LVL]| Name
======================================================================
[NPK][IMPL]| Lared is sometimes AFK.
[ PK][ 1]| Testbob is a newbie.
Here's the sticking point. With one lone connection it works fine (and I test against null to make sure that a player actually exists within my player stack; that isn't the issue). When a second player connects and tries to use the WHO command, it explodes.
I've fought with it for the past two days and am getting no progress. Does this situation sound similar to anyone else's?
Source code for the application will be available when I get home.