Missing nullptr check in sys_openat

上级 93f8127a
......@@ -297,7 +297,7 @@ sys_openat(int dirfd, const char *path, int omode)
return -1;
} else {
struct file *fdir = myproc()->ofile[dirfd];
if (fdir->type != file::FD_INODE)
if (fdir == nullptr || fdir->type != file::FD_INODE)
return -1;
cwd = fdir->ip;
}
......
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论