diff options
author | Sergei Golubchik <sergii@pisem.net> | 2013-02-28 19:00:58 +0100 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2013-02-28 19:00:58 +0100 |
commit | 6b31e63177e0c16d92e460302bae9b2c92c8f500 (patch) | |
tree | d206f4c8848a50899d8d0656e8c8212189365ace /mysys/my_lib.c | |
parent | f4e7c093726a0143fd734b588c10e2b7780fe9ab (diff) | |
parent | 3251e4549c7541557546d0550ddfafa1574fe5ce (diff) | |
download | mariadb-git-6b31e63177e0c16d92e460302bae9b2c92c8f500.tar.gz |
5.1 -> 5.2 merge
Diffstat (limited to 'mysys/my_lib.c')
-rw-r--r-- | mysys/my_lib.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/mysys/my_lib.c b/mysys/my_lib.c index c18d14fb549..8bd9a289176 100644 --- a/mysys/my_lib.c +++ b/mysys/my_lib.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -11,7 +11,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ /* TODO: check for overun of memory for names. */ /* Convert MSDOS-TIME to standar time_t (still needed?) */ @@ -103,7 +104,7 @@ MY_DIR *my_dir(const char *path, myf MyFlags) MEM_ROOT *names_storage; DIR *dirp; struct dirent *dp; - char tmp_path[FN_REFLEN+1],*tmp_file; + char tmp_path[FN_REFLEN + 2], *tmp_file; #ifdef THREAD char dirent_tmp[sizeof(struct dirent)+_POSIX_PATH_MAX+1]; #endif @@ -215,10 +216,11 @@ char * directory_file_name (char * dst, const char *src) /* Process as Unix format: just remove test the final slash. */ char * end; + DBUG_ASSERT(strlen(src) < (FN_REFLEN + 1)); if (src[0] == 0) src= (char*) "."; /* Use empty as current */ - end=strmov(dst, src); + end= strnmov(dst, src, FN_REFLEN + 1); if (end[-1] != FN_LIBCHAR) { end[0]=FN_LIBCHAR; /* Add last '/' */ |