diff --git a/src/cpath.c b/src/cpath.c index 998523f..50531f6 100644 --- a/src/cpath.c +++ b/src/cpath.c @@ -7,7 +7,7 @@ #if defined(__unix__) || defined(__APPLE__) || defined(__ANDROID__) INTERNAL char path_sep = '/'; #elif defined(_WIN32) || defined(_WIN64) -INTERNAL char path_sep = '\'; +INTERNAL char path_sep = '\\'; #endif void join_root_and_leaf(const char *root, const char *leaf, char *dst); @@ -70,7 +70,9 @@ void join_root_and_leaf(const char *root, const char *leaf, char *dst) { ++leaf_start; } - strncpy(dst, root, ++root_end); + memcpy(dst, root, ++root_end); + dst[root_end] = path_sep; - strncpy(&(dst[++root_end]), &(leaf[leaf_start]), leaf_length - leaf_start); + + memcpy(&(dst[++root_end]), &(leaf[leaf_start]), leaf_length - leaf_start); }