summaryrefslogtreecommitdiff
path: root/mysys/default.c
diff options
context:
space:
mode:
authorunknown <msvensson@neptunus.(none)>2006-05-11 14:13:14 +0200
committerunknown <msvensson@neptunus.(none)>2006-05-11 14:13:14 +0200
commita9e0d2779e16bfd33292accfd3e417713381bd5c (patch)
treed7d75583e99a84dfb79f42ef1fcfd56c41521b58 /mysys/default.c
parent5854f65b29c91479515b186fae73d1a85169600d (diff)
downloadmariadb-git-a9e0d2779e16bfd33292accfd3e417713381bd5c.tar.gz
Bug#15328 Segmentation fault occured if my.cnf is invalid for escape sequence
- Check that length of value is longer than 1 before decrementing length by 2. - Backport from 5.0, make it possible to use my_print_defaults in tests mysql-test/mysql-test-run.pl: Backport from 5.0, make it possible to use my_print_defaults from tests mysql-test/mysql-test-run.sh: Backport from 5.0, make it possible to use my_print_defaults from tests mysql-test/r/mysqldump.result: Update result mysql-test/t/mysqldump.test: Test that my_print default don't segfault when encountering an option without closing " mysys/default.c: Check that length of value is longer than 1 before deciding to decrement its length by 2. mysql-test/std_data/bug15328.cnf: New BitKeeper file ``mysql-test/std_data/bug15328.cnf''
Diffstat (limited to 'mysys/default.c')
-rw-r--r--mysys/default.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/mysys/default.c b/mysys/default.c
index 9510cfb3464..6e40c48d82a 100644
--- a/mysys/default.c
+++ b/mysys/default.c
@@ -579,7 +579,9 @@ static int search_default_file_with_ext(DYNAMIC_ARRAY *args, MEM_ROOT *alloc,
value_end=value;
/* remove quotes around argument */
- if ((*value == '\"' || *value == '\'') && *value == value_end[-1])
+ if ((*value == '\"' || *value == '\'') && /* First char is quote */
+ (value + 1 < value_end ) && /* String is longer than 1 */
+ *value == value_end[-1] ) /* First char is equal to last char */
{
value++;
value_end--;