diff options
Diffstat (limited to 'mysys/mf_loadpath.c')
-rw-r--r-- | mysys/mf_loadpath.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/mysys/mf_loadpath.c b/mysys/mf_loadpath.c index 48a69207839..510c72ffa38 100644 --- a/mysys/mf_loadpath.c +++ b/mysys/mf_loadpath.c @@ -26,7 +26,8 @@ char * my_load_path(char * to, const char *path, const char *own_path_prefix) { - char buff[FN_REFLEN]; + char buff[FN_REFLEN+1]; + const char *from= buff; int is_cur; DBUG_ENTER("my_load_path"); DBUG_PRINT("enter",("path: %s prefix: %s",path, @@ -34,7 +35,7 @@ char * my_load_path(char * to, const char *path, if ((path[0] == FN_HOMELIB && path[1] == FN_LIBCHAR) || test_if_hard_path(path)) - VOID(strmov(buff,path)); + from= path; else if ((is_cur=(path[0] == FN_CURLIB && path[1] == FN_LIBCHAR)) || (is_prefix(path,FN_PARENTDIR)) || ! own_path_prefix) @@ -42,13 +43,16 @@ char * my_load_path(char * to, const char *path, if (is_cur) is_cur=2; /* Remove current dir */ if (! my_getwd(buff,(uint) (FN_REFLEN-strlen(path)+is_cur),MYF(0))) - VOID(strcat(buff,path+is_cur)); + { + size_t length= strlen(buff); + (void) strmake(buff + length, path+is_cur, FN_REFLEN - length); + } else - VOID(strmov(buff,path)); /* Return org file name */ + from= path; /* Return org file name */ } else - VOID(strxmov(buff,own_path_prefix,path,NullS)); - strmov(to,buff); + (void) strxnmov(buff, FN_REFLEN, own_path_prefix, path, NullS); + strmake(to, from, FN_REFLEN-1); DBUG_PRINT("exit",("to: %s",to)); DBUG_RETURN(to); } /* my_load_path */ |