diff options
author | Tatiana Azundris Nurnberg <azundris@sun.com> | 2011-05-05 06:39:38 +0100 |
---|---|---|
committer | Tatiana Azundris Nurnberg <azundris@sun.com> | 2011-05-05 06:39:38 +0100 |
commit | 9d80d48806b4b4a5fdf42b3985ca4b8610639e95 (patch) | |
tree | b4a1f26750c960fb55759c1246aa8ad2db10cda6 /sql/my_decimal.cc | |
parent | 22639a066cde7b18133f81ca8c0528e115c08677 (diff) | |
parent | ccbc24b45a79b6407487550fa19b40752d22fa7f (diff) | |
download | mariadb-git-9d80d48806b4b4a5fdf42b3985ca4b8610639e95.tar.gz |
auto-merge conservative fix for Bug#55436/Bug#11762799
Diffstat (limited to 'sql/my_decimal.cc')
-rw-r--r-- | sql/my_decimal.cc | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/sql/my_decimal.cc b/sql/my_decimal.cc index 26377bc1562..d3db28e370f 100644 --- a/sql/my_decimal.cc +++ b/sql/my_decimal.cc @@ -95,10 +95,11 @@ int my_decimal2string(uint mask, const my_decimal *d, UNSIGNED. Hence the buffer for a ZEROFILLed value is the length the user requested, plus one for a possible decimal point, plus one if the user only wanted decimal places, but we force a leading - zero on them. Because the type is implicitly UNSIGNED, we do not - need to reserve a character for the sign. For all other cases, - fixed_prec will be 0, and my_decimal_string_length() will be called - instead to calculate the required size of the buffer. + zero on them, plus one for the '\0' terminator. Because the type + is implicitly UNSIGNED, we do not need to reserve a character for + the sign. For all other cases, fixed_prec will be 0, and + my_decimal_string_length() will be called instead to calculate the + required size of the buffer. */ int length= (fixed_prec ? (fixed_prec + ((fixed_prec == fixed_dec) ? 1 : 0) + 1) @@ -276,7 +277,7 @@ print_decimal_buff(const my_decimal *dec, const uchar* ptr, int length) const char *dbug_decimal_as_string(char *buff, const my_decimal *val) { - int length= DECIMAL_MAX_STR_LENGTH; + int length= DECIMAL_MAX_STR_LENGTH + 1; /* minimum size for buff */ if (!val) return "NULL"; (void)decimal2string((decimal_t*) val, buff, &length, 0,0,0); |