summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorBjorn Munch <bjorn.munch@oracle.com>2011-09-26 10:06:25 +0200
committerBjorn Munch <bjorn.munch@oracle.com>2011-09-26 10:06:25 +0200
commit031b52c415c3fe179117dc3ebc9b0a34914f1342 (patch)
treed2facafdfdb9e6e31a6c1c959c5edeea303ed958 /client
parent50efe241c90214c636090c6eda4673881aaabd48 (diff)
parent7f729cfac492ecc6e581f2d07c41a49726fa2e04 (diff)
downloadmariadb-git-031b52c415c3fe179117dc3ebc9b0a34914f1342.tar.gz
merge from 5.1 main
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