View Single Post
  #1  
Old 11-13-2003, 03:13 PM
kate
Fire Beetle
 
Join Date: Nov 2002
Posts: 10
Default ZSList::SendWhoAll, wold server related crash bug FIX

Ok, after a little debugging, I think I got a fix.

The bug seems to be a linux only problem cased by people doing alot of /who all commands.

Ok, the file is world/zoneserver.cpp

function is: ZSList::SendWhoAll

ok here is the fix:

scroll down till you see this:
Code:
        int32 unknown52=totalusers;
        int32 unknown56=1;
        ServerPacket* pack2 = new ServerPacket(0x2010,64+totallength+(49*totalusers));
        char *buffer=(char*)malloc(pack2->size);
        char *bufptr=buffer;
        memset(buffer,0,pack2->size);
        memcpy(bufptr,&plid, sizeof(int32));
ok, the change starts with:
char *buffer=(char*)malloc(pack2->size);

make it read:
Code:
        int32 unknown52=totalusers;
        int32 unknown56=1;
        ServerPacket* pack2 = new ServerPacket(0x2010,64+totallength+(49*totalusers));
 //       char *buffer=(char*)malloc(pack2->size);
        uchar buffer[pack2->size]; // added line
        uchar *bufptr=buffer; // changed line
        memset(buffer,0,pack2->size);
Then at the end of the function you see:
Code:
        safe_delete(pack2);
        free(buffer);
        safe_delete(output);
}
and comment out the free line.
should like like this:
Code:
        safe_delete(pack2);
//      free(buffer);
        safe_delete(output);
}
Anyway, I have this running on the stormweavers server with no problems, let me know how the rest of you do.

This fix should work under windows as well, though at this point in time that has not been tested.
Reply With Quote