[hackers] [scc] Fix realloc size in parameter() || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Fri, 7 Aug 2015 23:02:57 +0200 (CEST)

commit 3e8227a60580f6542a8fccc18fd8716c887ba1b7
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Fri Aug 7 23:02:14 2015 +0200
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Fri Aug 7 23:02:14 2015 +0200

    Fix realloc size in parameter()
    
    We were passing the number of elements to realloc, and not
    the size of the buffer.

diff --git a/cc1/decl.c b/cc1/decl.c
index c8c96f1..6fdad29 100644
--- a/cc1/decl.c
+++ b/cc1/decl.c
_AT_@ -75,7 +75,7 @@ parameter(Symbol *sym, int sclass, Type *data)
                 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;
 }
Received on Fri Aug 07 2015 - 23:02:57 CEST

This archive was generated by hypermail 2.3.0 : Fri Aug 07 2015 - 23:12:11 CEST