Whamcloud - gitweb
LU-11233 utils: fix build warnings for gcc8
[fs/lustre-release.git] / lustre / utils / liblustreapi_layout.c
index b967356..bb1b5fc 100644 (file)
@@ -775,7 +775,7 @@ static void get_parent_dir(const char *path, char *buf, size_t size)
 {
        char *p;
 
-       strncpy(buf, path, size);
+       strncpy(buf, path, size - 1);
        p = strrchr(buf, '/');
 
        if (p != NULL) {