[hackers] [scc] Avoid segfault in expand() || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Sun, 19 Jul 2015 09:48:32 +0200 (CEST)

commit 9e4dc8bf34a6c59f7073d95dc7df06d91168d833
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Sun Jul 19 09:31:38 2015 +0200
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Sun Jul 19 09:31:38 2015 +0200

    Avoid segfault in expand()
    
    The debug fprintf in expect() was using macroname, which was
    not defined in the case of symfile and symline.

diff --git a/cc1/cpp.c b/cc1/cpp.c
index c86002f..f236723 100644
--- a/cc1/cpp.c
+++ b/cc1/cpp.c
_AT_@ -194,6 +194,7 @@ expand(char *begin, Symbol *sym)
         char *s = sym->u.s;
         char *arglist[NR_MACROARG], arguments[INPUTSIZ], buffer[BUFSIZE];
 
+ macroname = sym->name;
         if (sym == symfile) {
                 elen = sprintf(buffer, "\"%s\"", input->fname);
                 goto substitute;
_AT_@ -203,7 +204,6 @@ expand(char *begin, Symbol *sym)
                 goto substitute;
         }
 
- macroname = sym->name;
         if (!parsepars(arguments, arglist, atoi(s)))
                 return 0;
         for (n = 0; n < atoi(s); ++n)
Received on Sun Jul 19 2015 - 09:48:32 CEST

This archive was generated by hypermail 2.3.0 : Sun Jul 19 2015 - 10:00:17 CEST