version 1.79 | | version 1.80 |
---|
| | |
/* | | /* |
* static char *rcsid_init_c = | | * static char *rcsid_init_c = |
* "$Id: request.c,v 1.79 2006/01/13 07:10:43 mwedel Exp $"; | | * "$Id: request.c,v 1.80 2006/01/13 20:42:02 cavesomething Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
static void append_spell (player *pl, SockList *sl, object *spell) { | | static void append_spell (player *pl, SockList *sl, object *spell) { |
int len, i, skill=0; | | int len, i, skill=0; |
| | |
if (spell->type != SPELL) return; | | |
if (!(spell->name)) { | | if (!(spell->name)) { |
LOG(llevError, "item number %d is a spell with no name.\n", spell->count); | | LOG(llevError, "item number %d is a spell with no name.\n", spell->count); |
return; | | return; |
| | |
* is hundreds of bytes off, so correcting 22 vs 26 doesn't seem | | * is hundreds of bytes off, so correcting 22 vs 26 doesn't seem |
* like it will fix this | | * like it will fix this |
*/ | | */ |
| | if (spell->type != SPELL) continue; |
if (sl.len > (MAXSOCKBUF - (26 + strlen(spell->name) + | | if (sl.len > (MAXSOCKBUF - (26 + strlen(spell->name) + |
spell->msg?strlen(spell->msg):0))) { | | (spell->msg?strlen(spell->msg):0)))) { |
Send_With_Handling(&pl->socket, &sl); | | Send_With_Handling(&pl->socket, &sl); |
strcpy(sl.buf,"addspell "); | | strcpy(sl.buf,"addspell "); |
sl.len=strlen((char*)sl.buf); | | sl.len=strlen((char*)sl.buf); |
| | |
append_spell(pl, &sl, spell); | | append_spell(pl, &sl, spell); |
} | | } |
} | | } |
| | else if (spell->type != SPELL) { |
| | LOG(llevError, "Asked to send a non-spell object as a spell"); |
| | return; |
| | } |
else append_spell(pl, &sl, spell); | | else append_spell(pl, &sl, spell); |
if (sl.len > MAXSOCKBUF) { | | if (sl.len > MAXSOCKBUF) { |
LOG(llevError,"Buffer overflow in send_spell_list!\n"); | | LOG(llevError,"Buffer overflow in esrv_add_spells!\n"); |
fatal(0); | | fatal(0); |
} | | } |
/* finally, we can send the packet */ | | /* finally, we can send the packet */ |