[hackers] [scc] Avoid segmentation fault in mktype() || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Fri, 14 Aug 2015 07:48:45 +0200 (CEST)

commit d691713e7dd054277bf83dc26b0b1d2a92fd5409
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Fri Aug 14 07:44:22 2015 +0200
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Fri Aug 14 07:44:22 2015 +0200

    Avoid segmentation fault in mktype()
    
    When mktype detects that the new type was already created
    it tries to free the parameter received, so it is very
    important that this parameter must to have a correct
    value.

diff --git a/cc1/decl.c b/cc1/decl.c
index 71925ff..087f5af 100644
--- a/cc1/decl.c
+++ b/cc1/decl.c
_AT_@ -42,9 +42,11 @@ push(struct declarators *dp, unsigned op, ...)
         va_start(va, op);
         if ((n = dp->nr++) == NR_DECLARATORS)
                 error("too much declarators");
- p = &dp->d[n];
 
+ p = &dp->d[n];
         p->op = op;
+ p->tpars = NULL;
+
         switch (op) {
         case ARY:
                 p->nelem = va_arg(va, unsigned);
Received on Fri Aug 14 2015 - 07:48:45 CEST

This archive was generated by hypermail 2.3.0 : Fri Aug 14 2015 - 08:00:11 CEST