shithub: scc

Download patch

ref: 3e8227a60580f6542a8fccc18fd8716c887ba1b7
parent: ab74e508b10e6bdf39ae71e204bf91642257d689
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Fri Aug 7 19:02:14 EDT 2015

Fix realloc size in parameter()

We were passing the number of elements to realloc, and not
the size of the buffer.

--- a/cc1/decl.c
+++ b/cc1/decl.c
@@ -75,7 +75,7 @@
 		error("bad storage class in function parameter");
 	if (n++ == NR_FUNPARAM)
 		error("too much parameters in function definition");
-	funtp->pars = xrealloc(funtp->pars, n);
+	funtp->pars = xrealloc(funtp->pars, n * sizeof(Type *));
 	funtp->pars[n-1] = tp;
 	funtp->n.elem = n;
 }