shithub: 9pro

Download patch

ref: 1a8989a556d7eebe4780f07ae89462f681fe733a
parent: ed4fa7190493a132e7f2d340b4c7c0ac228795e5
author: Sigrid Solveig Haflínudóttir <[email protected]>
date: Fri Apr 30 10:55:02 EDT 2021

9gc: make sure s is never NULL in ctxregistryR loop

--- a/9gc.c
+++ b/9gc.c
@@ -214,7 +214,7 @@
 static void
 ctxregistryR(C9ctx *ctx, C9r *r)
 {
-	char *s, *b;
+	char *s, *b, *e;
 	C9aux *a;
 	C9tag tag;
 	const char *path[2];
@@ -245,8 +245,8 @@
 				s = (char*)&r->read.data[r->read.size];
 			else
 				*s++ = 0;
-			if (strstr(b, "tlssrv") == NULL && (s = strchr(b, ' ')) != NULL) {
-				*s = 0;
+			if (strstr(b, "tlssrv") == NULL && (e = strchr(b, ' ')) != NULL) {
+				*e = 0;
 fallback:
 				close(a->f);
 				if ((a->f = dial(b)) < 0)