Should fix the 'crash' bug related to input > 2 kb, as well as fix the mobile deletion crash bug, also a small memory leak plugged
This commit is contained in:
@@ -0,0 +1,10 @@
|
|||||||
|
Text test~
|
||||||
|
Body a test
|
||||||
|
~
|
||||||
|
Name Taoth~
|
||||||
|
IdNum 3
|
||||||
|
Dated 1329779435
|
||||||
|
Level 1
|
||||||
|
Room 3001
|
||||||
|
Flags 0 0 0 0
|
||||||
|
End
|
||||||
|
|||||||
@@ -1906,7 +1906,7 @@ static int process_input(struct descriptor_data *t)
|
|||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
bytes_read = perform_socket_read(t->descriptor, read_buf, MAX_PROTOCOL_BUFFER);
|
bytes_read = perform_socket_read(t->descriptor, read_buf, space_left);
|
||||||
|
|
||||||
if ( bytes_read >= 0 )
|
if ( bytes_read >= 0 )
|
||||||
{
|
{
|
||||||
|
|||||||
34
src/genmob.c
34
src/genmob.c
@@ -102,17 +102,46 @@ int copy_mobile(struct char_data *to, struct char_data *from)
|
|||||||
static void extract_mobile_all(mob_vnum vnum)
|
static void extract_mobile_all(mob_vnum vnum)
|
||||||
{
|
{
|
||||||
struct char_data *next, *ch;
|
struct char_data *next, *ch;
|
||||||
|
int i;
|
||||||
|
|
||||||
for (ch = character_list; ch; ch = next) {
|
for (ch = character_list; ch; ch = next) {
|
||||||
next = ch->next;
|
next = ch->next;
|
||||||
if (GET_MOB_VNUM(ch) == vnum)
|
if (GET_MOB_VNUM(ch) == vnum) {
|
||||||
|
if ((i = GET_MOB_RNUM(ch)) != NOBODY) {
|
||||||
|
if (ch->player.name && ch->player.name != mob_proto[i].player.name)
|
||||||
|
free(ch->player.name);
|
||||||
|
ch->player.name = NULL;
|
||||||
|
|
||||||
|
if (ch->player.title && ch->player.title != mob_proto[i].player.title)
|
||||||
|
free(ch->player.title);
|
||||||
|
ch->player.title = NULL;
|
||||||
|
|
||||||
|
if (ch->player.short_descr && ch->player.short_descr != mob_proto[i].player.short_descr)
|
||||||
|
free(ch->player.short_descr);
|
||||||
|
ch->player.short_descr = NULL;
|
||||||
|
|
||||||
|
if (ch->player.long_descr && ch->player.long_descr != mob_proto[i].player.long_descr)
|
||||||
|
free(ch->player.long_descr);
|
||||||
|
ch->player.long_descr = NULL;
|
||||||
|
|
||||||
|
if (ch->player.description && ch->player.description != mob_proto[i].player.description)
|
||||||
|
free(ch->player.description);
|
||||||
|
ch->player.description = NULL;
|
||||||
|
|
||||||
|
/* free script proto list if it's not the prototype */
|
||||||
|
if (ch->proto_script && ch->proto_script != mob_proto[i].proto_script)
|
||||||
|
free_proto_script(ch, MOB_TRIGGER);
|
||||||
|
ch->proto_script = NULL;
|
||||||
|
}
|
||||||
extract_char(ch);
|
extract_char(ch);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int delete_mobile(mob_rnum refpt)
|
int delete_mobile(mob_rnum refpt)
|
||||||
{
|
{
|
||||||
struct char_data *live_mob;
|
struct char_data *live_mob;
|
||||||
|
struct char_data *proto;
|
||||||
int counter, cmd_no;
|
int counter, cmd_no;
|
||||||
mob_vnum vnum;
|
mob_vnum vnum;
|
||||||
zone_rnum zone;
|
zone_rnum zone;
|
||||||
@@ -127,7 +156,10 @@ int delete_mobile(mob_rnum refpt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
vnum = mob_index[refpt].vnum;
|
vnum = mob_index[refpt].vnum;
|
||||||
|
proto = &mob_proto[refpt];
|
||||||
|
|
||||||
extract_mobile_all(vnum);
|
extract_mobile_all(vnum);
|
||||||
|
extract_char(proto);
|
||||||
|
|
||||||
for (counter = refpt; counter < top_of_mobt; counter++) {
|
for (counter = refpt; counter < top_of_mobt; counter++) {
|
||||||
mob_index[counter] = mob_index[counter + 1];
|
mob_index[counter] = mob_index[counter + 1];
|
||||||
|
|||||||
@@ -419,6 +419,8 @@ void ProtocolInput( descriptor_t *apDescriptor, char *apData, int aSize, char *a
|
|||||||
{
|
{
|
||||||
const char *pClientName = pProtocol->pVariables[eMSDP_CLIENT_ID]->pValueString;
|
const char *pClientName = pProtocol->pVariables[eMSDP_CLIENT_ID]->pValueString;
|
||||||
|
|
||||||
|
InfoMessage(apDescriptor, "Receiving MXP Version From Client.\r\n");
|
||||||
|
|
||||||
free(pProtocol->pVariables[eMSDP_CLIENT_VERSION]->pValueString);
|
free(pProtocol->pVariables[eMSDP_CLIENT_VERSION]->pValueString);
|
||||||
pProtocol->pVariables[eMSDP_CLIENT_VERSION]->pValueString = AllocString(pMXPTag);
|
pProtocol->pVariables[eMSDP_CLIENT_VERSION]->pValueString = AllocString(pMXPTag);
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ typedef struct descriptor_data descriptor_t;
|
|||||||
|
|
||||||
#define SNIPPET_VERSION 6 /* Helpful for debugging */
|
#define SNIPPET_VERSION 6 /* Helpful for debugging */
|
||||||
|
|
||||||
#define MAX_PROTOCOL_BUFFER 2048
|
#define MAX_PROTOCOL_BUFFER MAX_RAW_INPUT_LENGTH
|
||||||
#define MAX_VARIABLE_LENGTH 4096
|
#define MAX_VARIABLE_LENGTH 4096
|
||||||
#define MAX_OUTPUT_BUFFER LARGE_BUFSIZE
|
#define MAX_OUTPUT_BUFFER LARGE_BUFSIZE
|
||||||
#define MAX_MSSP_BUFFER 4096
|
#define MAX_MSSP_BUFFER 4096
|
||||||
|
|||||||
Reference in New Issue
Block a user