summaryrefslogtreecommitdiff
path: root/sql/protocol.cc
diff options
context:
space:
mode:
authorunknown <tnurnberg@mysql.com/white.intern.koehntopp.de>2007-11-27 18:24:24 +0100
committerunknown <tnurnberg@mysql.com/white.intern.koehntopp.de>2007-11-27 18:24:24 +0100
commit7c0db983ad8eb8e1d37cf8468bbfd32de87a14ad (patch)
treed0bc328d66d11495bd78a8407e6acc38d17454a6 /sql/protocol.cc
parent6facf554bde0d1e6810ae008a007a994abb475d6 (diff)
downloadmariadb-git-7c0db983ad8eb8e1d37cf8468bbfd32de87a14ad.tar.gz
Bug#32707: misdimensioned buffer in protocol layer
Miscalculation in protocol-layer: size buffer correctly so even really long error messages cannot overflow our buffer. sql/protocol.cc: size buffer correctly so really long error messages cannot overflow it.
Diffstat (limited to 'sql/protocol.cc')
-rw-r--r--sql/protocol.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/sql/protocol.cc b/sql/protocol.cc
index 7c7dfaf7bef..f7a34fde94a 100644
--- a/sql/protocol.cc
+++ b/sql/protocol.cc
@@ -56,7 +56,10 @@ void send_error(THD *thd, uint sql_errno, const char *err)
{
#ifndef EMBEDDED_LIBRARY
uint length;
- char buff[MYSQL_ERRMSG_SIZE+2], *pos;
+ /*
+ buff[]: sql_errno:2 + ('#':1 + SQLSTATE_LENGTH:5) + MYSQL_ERRMSG_SIZE:512
+ */
+ char buff[2+1+SQLSTATE_LENGTH+MYSQL_ERRMSG_SIZE], *pos;
#endif
const char *orig_err= err;
NET *net= &thd->net;