shithub: gefs

Download patch

ref: 21eca27c6491c176c7f337de9c55e31ee70592b0
parent: f5a0673424c39533b76e08a3b4a754c3f66f4bb4
author: Michael Forney <mforney@mforney.org>
date: Tue Mar 29 15:53:54 EDT 2022

fs: check search permission when walking

--- a/fs.c
+++ b/fs.c
@@ -871,6 +871,11 @@
 	dmode = d.mode;
 	r.type = Rwalk;
 	for(i = 0; i < m->nwname; i++){
+		if(fsaccess(o, d.mode, d.uid, d.gid, DMEXEC) != 0){
+			rerror(m, Eperm);
+			putfid(o);
+			return;
+		}
 		name = m->wname[i];
 		if(strcmp(m->wname[i], "..") == 0){
 			if((e = findparent(o, &prev, &name, kbuf, sizeof(kbuf))) != nil){