PDA

View Full Version : Items


LostZaphod
10-10-2006, 01:25 PM
FatherNitwit could you please look into this?....

To make a long story short (trying to find why lvl 60 monk can crash world.exe) i found out that there is a over run when loading the items.

The message I receive is (windows 2003 server, ms vstudio 2003 1.1)

"run-time check failure #2 stack around variable 'item' was corrupeted"

the cause of the error is the items.filename in the database is varchar(32) and the filename in the item_struct.h is "char Filename[15];"

inside of shareddb.cpp
strcpy(item.Filename,row[ItemField::filename]);
is used to copy the database item into memory. strcpy does not check the boundry and over rights memory of items after the structure (Filename[15] is at the end of the structure)

I made this sql to adjust the items table, but it just gets around the issue.
update `items` set filename=substring(filename,1,15) where length(filename) > 15

Is the "Filename" field to be 32 or 15 characters?.