diff options
author | Mats Kindahl <mats.kindahl@oracle.com> | 2011-02-08 11:21:14 +0100 |
---|---|---|
committer | Mats Kindahl <mats.kindahl@oracle.com> | 2011-02-08 11:21:14 +0100 |
commit | 3bea4a20a4d9ddce774512bbe53ea47a44754c49 (patch) | |
tree | 4f761a6febac5039918f44935125c7e869c35fae /mysys | |
parent | 37adcd8c400c03d0bbb36c8a7505b1c747d2763d (diff) | |
download | mariadb-git-3bea4a20a4d9ddce774512bbe53ea47a44754c49.tar.gz |
Bug #58455
Starting mysqld with defaults file without
extension cause segmentation fault
Bug occurs because fn_expand calls fn_format
with NULL as ext.
This is a backport of the patch from 5.6.
Patch solve this problem by using an empty
string as extension, and adding assertions
to fn_format that correct arguments are passed.
It also add a test tests several variations of
using non-existing defaults files.
Diffstat (limited to 'mysys')
-rw-r--r-- | mysys/default.c | 2 | ||||
-rw-r--r-- | mysys/mf_format.c | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/mysys/default.c b/mysys/default.c index 432c3086254..9a4b990f003 100644 --- a/mysys/default.c +++ b/mysys/default.c @@ -179,7 +179,7 @@ fn_expand(const char *filename, char *result_buf) if (my_getwd(dir, sizeof(dir), MYF(0))) DBUG_RETURN(3); DBUG_PRINT("debug", ("dir: %s", dir)); - if (fn_format(result_buf, filename, dir, NULL, flags) == NULL) + if (fn_format(result_buf, filename, dir, "", flags) == NULL) DBUG_RETURN(2); DBUG_PRINT("return", ("result: %s", result_buf)); DBUG_RETURN(0); diff --git a/mysys/mf_format.c b/mysys/mf_format.c index 6afa2938fa3..74f114a966f 100644 --- a/mysys/mf_format.c +++ b/mysys/mf_format.c @@ -31,6 +31,8 @@ char * fn_format(char * to, const char *name, const char *dir, reg1 size_t length; size_t dev_length; DBUG_ENTER("fn_format"); + DBUG_ASSERT(name != NULL); + DBUG_ASSERT(extension != NULL); DBUG_PRINT("enter",("name: %s dir: %s extension: %s flag: %d", name,dir,extension,flag)); |