shithub: plan9front

Download patch

ref: 01ab07ef729a2dbade38906f4acf2827ea327952
parent: 3c1022a3deee758ab1cac307a1b0b46e4a5d0d52
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Tue Feb 2 19:19:19 EST 2021

acme: fix use after free in warning() call (thanks igor)

--- a/sys/src/cmd/acme/wind.c	Tue Feb  2 10:21:47 2021
+++ b/sys/src/cmd/acme/wind.c	Tue Feb  2 19:19:19 2021
@@ -610,13 +610,14 @@
 		r = runerealloc(r, n+1);
 		r[n] = 0;
 	}
-	free(a);
 	if((d->qid.type&QTDIR) == 0){
 		free(d);
 		warning(nil, "%s: not a directory\n", a);
 		free(r);
+		free(a);
 		return;
 	}
+	free(a);
 	free(d);
 	w->nincl++;
 	w->incl = realloc(w->incl, w->nincl*sizeof(Rune*));