shithub: gefs

Download patch

ref: fcf497d84bd8740b57f0b20a3982122d292009b3
parent: 1d87f43466480d3f9200260d88ea3d07bcb527a6
author: Ori Bernstein <ori@eigenstate.org>
date: Wed Nov 22 23:09:13 EST 2023

fs: deref uid/gid after nil check

--- a/fs.c
+++ b/fs.c
@@ -800,10 +800,10 @@
 	in = 0;
 	u = uid2user(uid);
 	g = uid2user(gid);
-	if(u->id == g->id)
-		in = 1;
 	if(u != nil && g != nil)
-		for(i = 0; i < g->nmemb; i++)
+		if(u->id == g->id)
+			in = 1;
+		else for(i = 0; i < g->nmemb; i++)
 			if(u->id == g->memb[i])
 				in = 1;
 	runlock(&fs->userlk);