提交 54047ef9 编写于 作者: J jpark37

libobs: Avoid strncpy warning

上级 5753c25c
......@@ -460,7 +460,10 @@ struct os_dirent *os_readdir(os_dir_t *dir)
if (!dir->cur_dirent)
return NULL;
strncpy(dir->out.d_name, dir->cur_dirent->d_name, 255);
const size_t length = strlen(dir->cur_dirent->d_name);
if (sizeof(dir->out.d_name) <= length)
return NULL;
memcpy(dir->out.d_name, dir->cur_dirent->d_name, length + 1);
dstr_copy(&file_path, dir->path);
dstr_cat(&file_path, "/");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册