diff --git a/fs/vfs/path_cache.c b/fs/vfs/path_cache.c index 5cd4afb1..c76eab56 100644 --- a/fs/vfs/path_cache.c +++ b/fs/vfs/path_cache.c @@ -107,7 +107,7 @@ struct PathCache *PathCacheAlloc(struct Vnode *parent, struct Vnode *vnode, cons return NULL; } - ret = strncpy_s(nc->name, pathCacheSize, name, len); + ret = strncpy_s(nc->name, len + 1, name, len); if (ret != LOS_OK) { return NULL; }