Skip to content
Snippets Groups Projects
Commit d5107694 authored by Guy Zana's avatar Guy Zana
Browse files

fix revert back to checking fd boundaries in fdset

dup3() may corrupt memory if new_fd is bigger than FDMAX
parent 319c2db2
No related branches found
No related tags found
No related merge requests found
......@@ -43,6 +43,9 @@ int fdset(int fd, struct file *fp)
{
struct file *orig;
if (fd < 0 || fd >= FDMAX)
return EBADF;
fhold(fp);
orig = __sync_val_compare_and_swap(&gfdt[fd], NULL, fp);
if (orig != NULL) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment