Commit 2416817a authored by Yoni Fogel's avatar Yoni Fogel

[t:2418] Fixed memory corruption error for using "" as env dir found by coverity

git-svn-id: file:///svn/toku/tokudb@18138 c7de825b-a66e-492c-adef-691d508d4ae1
parent 91dbbc63
...@@ -563,7 +563,7 @@ toku_env_open(DB_ENV * env, const char *home, u_int32_t flags, int mode) { ...@@ -563,7 +563,7 @@ toku_env_open(DB_ENV * env, const char *home, u_int32_t flags, int mode) {
BOOL made_new_home = FALSE; BOOL made_new_home = FALSE;
char* new_home = NULL; char* new_home = NULL;
toku_struct_stat buf; toku_struct_stat buf;
if (home[strlen(home)-1] == '\\') { if (strlen(home) > 1 && home[strlen(home)-1] == '\\') {
new_home = toku_malloc(strlen(home)); new_home = toku_malloc(strlen(home));
memcpy(new_home, home, strlen(home)); memcpy(new_home, home, strlen(home));
new_home[strlen(home) - 1] = 0; new_home[strlen(home) - 1] = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment