diff --git a/fs/vfs/path_cache.c b/fs/vfs/path_cache.c index 5cd4afb14f9c2c566bf409bb4aa4eebaaea5cb43..c76eab56d440dac086af7205b72f830940d1109c 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; }