summaryrefslogtreecommitdiff
path: root/mysys
diff options
context:
space:
mode:
authorunknown <gshchepa/uchum@gshchepa.loc>2007-04-29 00:50:33 +0500
committerunknown <gshchepa/uchum@gshchepa.loc>2007-04-29 00:50:33 +0500
commitf90870e98fe0e5626ccef14eb5b324d06195243a (patch)
tree8887ecac910719b73a094e3f845e9ef086540a20 /mysys
parenta8f639fccc19ef80d67c52e698bf6366fdcf6f94 (diff)
downloadmariadb-git-f90870e98fe0e5626ccef14eb5b324d06195243a.tar.gz
Fixed bug #20710.
This bug occurs when error message length exceeds allowed limit: my_error() function outputs "%s" sequences instead of long string arguments. Formats like %-.64s are very common in errmsg.txt files, however my_error() function simply ignores precision of those formats. mysys/my_error.c: Fixed bug #20710. This bug occurs when error message length exceeds allowed limit: my_error() function output "%s" sequences instead of long string arguments. my_error() function has been fixed to accept formats like %-.64s. mysql-test/t/alter_table.test: Added test case for bug #20710. mysql-test/r/alter_table.result: Added test case for bug #20710.
Diffstat (limited to 'mysys')
-rw-r--r--mysys/my_error.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/mysys/my_error.c b/mysys/my_error.c
index 8a377f63c7e..0f8ffb7c05f 100644
--- a/mysys/my_error.c
+++ b/mysys/my_error.c
@@ -82,6 +82,11 @@ int my_error(int nr,myf MyFlags, ...)
If "%.*u" or "%.*d" are encountered, the precision number is read
from the variable argument list but its value is ignored.
*/
+ if (*tpos == '-')
+ {
+ tpos++;
+ olen--;
+ }
prec_supplied= 0;
if (*tpos== '.')
{
@@ -94,6 +99,14 @@ int my_error(int nr,myf MyFlags, ...)
prec_chars= va_arg(ap, int); /* get length parameter */
prec_supplied= 1;
}
+ else
+ {
+ for (prec_chars= 0; my_isdigit(&my_charset_latin1, *tpos); tpos++, olen--)
+ {
+ prec_supplied= 1;
+ prec_chars= prec_chars * 10 + *tpos - '0';
+ }
+ }
}
if (!prec_supplied)