shithub: riscv

Download patch

ref: 45b498c027d1a460f79d7d545bf131a40acc40c2
parent: 50c9769bbdffc4d9b8d5122d1956f6ee5fd9f043
author: cinap_lenrek <[email protected]>
date: Sun Dec 2 07:32:23 EST 2012

ape: fix buffer overflow in _envsetup()

--- a/sys/src/ape/lib/ap/plan9/_envsetup.c
+++ b/sys/src/ape/lib/ap/plan9/_envsetup.c
@@ -59,6 +59,8 @@
 	for(j=0; j<nd; j++){
 		d9 = &d9a[j];
 		n = strlen(d9->name);
+		if(n >= sizeof(name)-4)
+			continue;
 		m = d9->length;
 		i = p - ps;
 		if(i+n+1+m+1 > psize) {