shithub: c9

Download patch

ref: d24ba6187aebabe39813ded5227516637b708626
parent: a9bd8e333995a54eeac6ebcca4bbdd3928a589f2
author: Sigrid Solveig Haflínudóttir <ftrvxmtrx@gmail.com>
date: Wed May 20 10:07:46 EDT 2020

fix: walk with 0 elements in path is totally valid

--- a/c9.c
+++ b/c9.c
@@ -277,8 +277,8 @@
 		}
 		sz += 2 + len[i];
 	}
-	if(path[i] != NULL || i == 0){
-		c->error("c9walk: invalid elements !(0 < %u <= %u)", i, C9maxpathel);
+	if(path[i] != NULL){
+		c->error("c9walk: invalid elements !(0 <= %u <= %u)", i, C9maxpathel);
 		return C9Epath;
 	}
 
@@ -497,7 +497,7 @@
 		break;
 
 	case Rwalk:
-		if(sz < 2+13 || (cnt = r16(&b))*13 > sz-2)
+		if(sz < 2 || (cnt = r16(&b))*13 > sz-2)
 			goto error;
 		if(cnt > C9maxpathel){
 			c->error("c9proc: Rwalk !(%u <= %u)", cnt, C9maxpathel);