diff options
author | Sergey Vojtovich <sergey.vojtovich@oracle.com> | 2010-12-01 15:56:46 +0300 |
---|---|---|
committer | Sergey Vojtovich <sergey.vojtovich@oracle.com> | 2010-12-01 15:56:46 +0300 |
commit | 21779b35eaf0bbbd9aad6c220012a12ff001cc11 (patch) | |
tree | d49a55d8fe727fc8e448bd19790e7a10d42b9902 /mysys/mf_pack.c | |
parent | 7009fd0e7d72327d11c53b180f05e80d64eff522 (diff) | |
download | mariadb-git-21779b35eaf0bbbd9aad6c220012a12ff001cc11.tar.gz |
BUG#58205 - Valgrind failure in fn_format when called from
archive_discover
Fixed buffer underrun in cleanup_dirname().
Also fixed that original (unencoded) database and table
names were used to discover archive tables.
mysql-test/r/archive.result:
A test case for BUG#58205.
mysql-test/t/archive.test:
A test case for BUG#58205.
mysys/mf_pack.c:
Fixed buffer underrun in cleanup_dirname(), when
it gets path like "a/../" (relative path, where
first directory is to be cut off).
storage/archive/ha_archive.cc:
Handler discover method gets database and table
names as is. It must use build_table_filename()
to get name similar to what it gets on create()
and open().
Diffstat (limited to 'mysys/mf_pack.c')
-rw-r--r-- | mysys/mf_pack.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/mysys/mf_pack.c b/mysys/mf_pack.c index c6e6a3a429e..a9482187138 100644 --- a/mysys/mf_pack.c +++ b/mysys/mf_pack.c @@ -192,7 +192,8 @@ size_t cleanup_dirname(register char *to, const char *from) end_parentdir=pos; while (pos >= start && *pos != FN_LIBCHAR) /* remove prev dir */ pos--; - if (pos[1] == FN_HOMELIB || memcmp(pos,parent,length) == 0) + if (pos[1] == FN_HOMELIB || + (pos > start && memcmp(pos, parent, length) == 0)) { /* Don't remove ~user/ */ pos=strmov(end_parentdir+1,parent); *pos=FN_LIBCHAR; |