From 392e362aacac0fc427fb696a28584fd97c2dc00f Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Tue, 4 Jun 2013 20:49:53 -0700 Subject: [PATCH] fix qoute length --- common/dbcore.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/dbcore.cpp b/common/dbcore.cpp index 600fe11a6..750dc7005 100644 --- a/common/dbcore.cpp +++ b/common/dbcore.cpp @@ -156,9 +156,10 @@ bool DBcore::RunQuery(const std::string& query, char* errbuf, MYSQL_RES** result void DBcore::DoEscapeString(std::string& outString, const char* frombuf, uint32 fromlen) { // No good reason to lock the DB, we only need it in the first place to check char encoding. // LockMutex lock(&MDatabase); - char* tobuf = new char[sizeof(frombuf)*fromlen*2](); + char* tobuf = new char[fromlen*2+1](); unsigned long length = mysql_real_escape_string(&mysql, tobuf, frombuf, fromlen); outString.assign(tobuf,length); + outString.resize(length); safe_delete_array(tobuf); }