[hackers] [scc] [cc1] Avoid error with macros without pattern || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Tue, 14 Jun 2016 12:18:19 +0200 (CEST)

commit badf250751e7443df7f671a7cf29a9151d04ca91
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Tue Jun 14 12:17:01 2016 +0200
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Tue Jun 14 12:17:01 2016 +0200

    [cc1] Avoid error with macros without pattern
    
    A macro can be defined and not have a replacement string
    so we have to test this case and don't try to expand
    a NULL string.

diff --git a/cc1/cpp.c b/cc1/cpp.c
index 82c6e48..f06fe95 100644
--- a/cc1/cpp.c
+++ b/cc1/cpp.c
_AT_@ -255,6 +255,8 @@ expand(char *begin, Symbol *sym)
                 elen = sprintf(buffer, "%d ", input->nline);
                 goto substitute;
         }
+ if (!s)
+ return 1;
 
         if (!parsepars(arguments, arglist, atoi(s)))
                 return 0;
Received on Tue Jun 14 2016 - 12:18:19 CEST

This archive was generated by hypermail 2.3.0 : Tue Jun 14 2016 - 12:24:15 CEST