shithub: riscv

Download patch

ref: 27921a1ba0e70a9f6c01f174d69749c689f625b5
parent: 1b619dea42e60be0316f03a358c52c2e86a6d654
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Wed Dec 26 00:04:56 EST 2018

mk: fix closing random fd from uninitialized stack variable (thanks BurnZeZ, mycroftiv)

mycroftiv → this is practically "500 mile email" territory - the "6 letter mk bug"

--- a/sys/src/cmd/mk/plan9.c
+++ b/sys/src/cmd/mk/plan9.c
@@ -199,7 +199,8 @@
 			perror(shell);
 			_exits("exec");
 		}
-		close(out[1]);
+		if(buf)
+			close(out[1]);
 		close(in[0]);
 		p = cmd+strlen(cmd);
 		while(cmd < p){