diff options
author | unknown <knielsen@knielsen-hq.org> | 2009-09-03 15:05:02 +0200 |
---|---|---|
committer | unknown <knielsen@knielsen-hq.org> | 2009-09-03 15:05:02 +0200 |
commit | 03db11cfdaabc27b57de342eb4974195745f90d6 (patch) | |
tree | 6345a3f93d0f780155ac26c54ea4c667aa28fc26 /mysys/my_getopt.c | |
parent | f58512d8b719b70250edf433b8aed72db382bb94 (diff) | |
download | mariadb-git-03db11cfdaabc27b57de342eb4974195745f90d6.tar.gz |
MBug#423035: error in parsing enum value for plugin variable in mysqld command-line option
Fix parsing of invalid plugin enum option value.
Previous patch to fix plugin enum option parsing on big-endian introduced another bug due
to incorrect comparison of unsigned value. This would cause an incorrect value to be
parsed as value 0.
See also MySQL Bug#41010 and Bug#32034.
mysql-test/mysql-test-run.pl:
Add a facility for test case to run the mysqld binary (to test that invalid startup options
are rejected correctly).
mysql-test/r/mysqld_option_err.result:
Add a test case to check that invalid startup options for mysqld are rejected.
This is needed to test MBug#423035.
Also add a few other similar tests, as this was completely untested before this patch.
mysql-test/t/mysqld_option_err.test:
Add a test case to check that invalid startup options for mysqld are rejected.
This is needed to test MBug#423035.
Also add a few other similar tests, as this was completely untested before this patch.
mysys/my_getopt.c:
Fix parsing of invalid plugin enum option value.
Diffstat (limited to 'mysys/my_getopt.c')
-rw-r--r-- | mysys/my_getopt.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c index 0de80b01c4f..d44ec162b93 100644 --- a/mysys/my_getopt.c +++ b/mysys/my_getopt.c @@ -603,6 +603,7 @@ static int setval(const struct my_option *opts, uchar* *value, char *argument, my_bool set_maximum_value) { int err= 0; + int pos; if (value && argument) { @@ -647,7 +648,9 @@ static int setval(const struct my_option *opts, uchar* *value, char *argument, return EXIT_OUT_OF_MEMORY; break; case GET_ENUM: - if (((*(ulong *)result_pos)= find_type(argument, opts->typelib, 2) - 1) < 0) + pos= find_type(argument, opts->typelib, 2) - 1; + (*(ulong *)result_pos)= pos; + if (pos < 0) return EXIT_ARGUMENT_INVALID; break; case GET_SET: |