shithub: riscv

Download patch

ref: 84b77568cda98a21dd4f3403a94c56724fbd5b37
parent: 37f5069426233b32403d0af5dba37f5400e030b7
author: cinap_lenrek <[email protected]>
date: Wed Jul 28 18:55:17 EDT 2021

kernel: fix off by one for $cputype buffer (thanks anthony martin)

--- a/sys/src/9/boot/boot.c
+++ b/sys/src/9/boot/boot.c
@@ -22,7 +22,7 @@
 	bind(root, "/", MAFTER);
 
 	buf[0] = '/';
-	buf[1+read(open("/env/cputype", OREAD|OCEXEC), buf+1, sizeof buf - 5)] = '\0';
+	buf[1+read(open("/env/cputype", OREAD|OCEXEC), buf+1, sizeof buf - 6)] = '\0';
 	strcat(buf, bin);
 	bind(buf, bin, MAFTER);
 	bind("/rc/bin", bin, MAFTER);