shithub: riscv

Download patch

ref: da689241d0ed5073412b347683acf278f2248683
parent: e20d7c4aad1056bf30a9dd7a109339c2ef95a16e
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Tue Apr 28 15:30:52 EDT 2015

sam: prevent array overflow with multiple -i and -a arguments (thanks clsmith)

--- a/sys/src/cmd/sam/sam.c
+++ b/sys/src/cmd/sam/sam.c
@@ -63,9 +63,13 @@
 	/* options for samterm */
 	case 'a':
 		*ap++ = "-a";
+		if(ap >= termargs+nelem(termargs))
+			usage();
 		break;
 	case 'i':
 		*ap++ = "-i";
+		if(ap >= termargs+nelem(termargs))
+			usage();
 		break;
 	}ARGEND
 	*ap = nil;