summaryrefslogtreecommitdiffstats
path: root/libglusterfs
diff options
context:
space:
mode:
Diffstat (limited to 'libglusterfs')
-rw-r--r--libglusterfs/src/common-utils.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c
index 0ba803dcd80..9fe1b6a4463 100644
--- a/libglusterfs/src/common-utils.c
+++ b/libglusterfs/src/common-utils.c
@@ -80,7 +80,9 @@ mkdir_p (char *path, mode_t mode, gf_boolean_t allow_symlinks)
char dir[PATH_MAX] = {0,};
struct stat stbuf = {0,};
- strcpy (dir, path);
+ strncpy (dir, path, (PATH_MAX - 1));
+ dir[PATH_MAX - 1] = '\0';
+
i = (dir[0] == '/')? 1: 0;
do {
if (path[i] != '/' && path[i] != '\0')