NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kern/47439: open() does not check for invalid flags



The following reply was made to PR kern/47439; it has been noted by GNATS.

From: coypu%SDF.ORG@localhost
To: gnats-bugs%netbsd.org@localhost
Cc: 
Subject: Re: kern/47439: open() does not check for invalid flags
Date: Sat, 3 Dec 2016 12:11:26 +0000

 Note there is the above:
 
         if (open_flags & O_SEARCH) {
                 open_flags &= ~(int)O_SEARCH;
         }
 
 How about something like:
 
 Index: vfs_syscalls.c
 ===================================================================
 RCS file: /cvsroot/src/sys/kern/vfs_syscalls.c,v
 retrieving revision 1.505
 diff -u -p -u -r1.505 vfs_syscalls.c
 --- vfs_syscalls.c	31 Jul 2016 20:34:04 -0000	1.505
 +++ vfs_syscalls.c	3 Dec 2016 12:02:21 -0000
 @@ -1562,7 +1562,7 @@ do_open(lwp_t *l, struct vnode *dvp, str
  		open_flags &= ~(int)O_SEARCH;
  	}
  
 -	flags = FFLAGS(open_flags);
 +	flags = FFLAGS(open_flags) & O_MASK;
  	if ((flags & (FREAD | FWRITE)) == 0)
  		return EINVAL;
  
 
 I've booted this.
 Also, same is done in a few other calls.
 


Home | Main Index | Thread Index | Old Index