aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorkaelima <kaelima@live.se>2011-10-31 00:02:32 +0100
committerkaelima <kaelima@live.se>2011-10-31 00:02:32 +0100
commitd9406b0e5940d2e18c72ed10a45658caf5c508cd (patch)
tree97f2a2ccdf1cb2c98d15df68dcdab7c07e61683f /src
parentd5ece59acd23bcd6a103162bbb410b65a6dd7e8d (diff)
Core/Commands: Add stupid-check for trying to add negative itemID to vendor. Fixes crash #3238
Diffstat (limited to 'src')
-rw-r--r--src/server/scripts/Commands/cs_npc.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp
index 0fecfa83221..3e799e70511 100644
--- a/src/server/scripts/Commands/cs_npc.cpp
+++ b/src/server/scripts/Commands/cs_npc.cpp
@@ -168,7 +168,11 @@ public:
return false;
}
- uint32 itemId = atol(pitem);
+ int32 item_int = atol(pitem);
+ if (item_int <= 0)
+ return true;
+
+ uint32 itemId = item_int;
char* fmaxcount = strtok(NULL, " "); //add maxcount, default: 0
uint32 maxcount = 0;