summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorTor Didriksen <tor.didriksen@oracle.com>2011-07-15 14:08:14 +0200
committerTor Didriksen <tor.didriksen@oracle.com>2011-07-15 14:08:14 +0200
commit93915d0d50c8024f2a9fce766893df285fdf1eb7 (patch)
treeefcb5cf4b52e64d01e8e24844ba776ab68a5a532 /client
parent08ecbd5adb9051b77dca4cea0988ea286366a409 (diff)
parentcfcd49b467dc5de004310db1ff0810842ea3bb56 (diff)
downloadmariadb-git-93915d0d50c8024f2a9fce766893df285fdf1eb7.tar.gz
merge 5.0-security => 5.1-security
Diffstat (limited to 'client')
-rw-r--r--client/sql_string.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/client/sql_string.cc b/client/sql_string.cc
index 17622fb7d98..c7e235522e0 100644
--- a/client/sql_string.cc
+++ b/client/sql_string.cc
@@ -118,7 +118,7 @@ bool String::set(ulonglong num, CHARSET_INFO *cs)
bool String::set(double num,uint decimals, CHARSET_INFO *cs)
{
- char buff[331];
+ char buff[FLOATING_POINT_BUFFER];
uint dummy_errors;
str_charset=cs;
@@ -188,7 +188,9 @@ end:
#else
#ifdef HAVE_SNPRINTF
buff[sizeof(buff)-1]=0; // Safety
- snprintf(buff,sizeof(buff)-1, "%.*f",(int) decimals,num);
+ int num_chars= snprintf(buff, sizeof(buff)-1, "%.*f",(int) decimals, num);
+ DBUG_ASSERT(num_chars > 0);
+ DBUG_ASSERT(num_chars < (int) sizeof(buff));
#else
sprintf(buff,"%.*f",(int) decimals,num);
#endif