Page 1 of 1

spawn set location - crash

Posted: Sun Aug 22, 2010 3:42 pm
by John Adams
With nothing targeted, performing the /spawn set location command crashes the world.

Code: Select all

   0: 01 00 0C 00 73 65 74 20 - 6C 6F 63 61 74 69 6F 6E  | ....set location

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb3bfeb70 (LWP 14815)]
0xb7b91073 in strlen () from /lib/tls/i686/cmov/libc.so.6
(gdb) bt
#0  0xb7b91073 in strlen () from /lib/tls/i686/cmov/libc.so.6
#1  0xb7f8050b in std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&) ()
   from /usr/lib/libstdc++.so.6
#2  0x080e4fda in Commands::Process (this=0x82f6ec0, index=1,
    command_parms=0xb3bfe0c4, client=0xb44006b0) at Commands.cpp:2571
#3  0x0812a23a in Client::HandlePacket (this=0xb44006b0, app=0xb4437b90)
    at client.cpp:1107
#4  0x0812dddc in Client::Process (this=0xb44006b0, zone_process=true)
    at client.cpp:1599
#5  0x081d621f in ZoneServer::ClientProcess (this=0xb4407d58)
    at zoneserver.cpp:1882
#6  0x081d95a1 in ZoneServer::Process (this=0xb4407d58) at zoneserver.cpp:883
#7  0x081d9a2e in ZoneLoop (tmp=0xb4407d58) at zoneserver.cpp:3878
#8  0xb7c6880e in start_thread () from /lib/tls/i686/cmov/libpthread.so.0
#9  0xb7beaa0e in clone () from /lib/tls/i686/cmov/libc.so.6

Re: spawn set location - crash

Posted: Sun Aug 22, 2010 4:24 pm
by Scatman
Commands.cpp line 2580

Changing

Code: Select all

case COMMAND_SPAWN_SET:{
	Spawn* spawn = client->GetPlayer()->GetTarget();
to

Code: Select all

case COMMAND_SPAWN_SET:{
	Spawn* spawn = client->GetPlayer()->GetTarget();
	if (!spawn) {
		client->SimpleMessage(CHANNEL_COLOR_YELLOW, "You must select a spawn in order to use /spawn set");
		break;
	}
should fix it.

Re: spawn set location - crash

Posted: Sun Aug 22, 2010 4:59 pm
by John Adams
SCAT! Holy shit. I just about fainted.

Btw, you know SVN is back, in case, you know, you wanted to see what it feels like to check something in ;)

If not, I'll do it tonight. No one else has crashed it there because it's a GM command that we've obviously never used.

Re: spawn set location - crash

Posted: Sun Aug 22, 2010 8:32 pm
by Sylaei
I found this error and corrected it. Needed a check for a null target.