[hackers] [scc] Don't search in the argument array when there is no arguments || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Fri, 21 Aug 2015 13:10:37 +0200 (CEST)

X-DEBUG-UPD: 5510ac1ca190a4bacb6330ca37a7ab5f0b347225
commit 5510ac1ca190a4bacb6330ca37a7ab5f0b347225
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Fri Aug 21 13:01:52 2015 +0200
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Fri Aug 21 13:01:52 2015 +0200

    Don't search in the argument array when there is no arguments
    
    This error was causing an invalid access to args array, because
    nargs could be -1, and the fallback condition to print again
    the token was failling due to it.

diff --git a/cc1/cpp.c b/cc1/cpp.c
index b5fd7a1..c3481bf 100644
--- a/cc1/cpp.c
+++ b/cc1/cpp.c
_AT_@ -285,7 +285,7 @@ getdefs(Symbol *args[NR_MACROARG], int nargs, char *bp, size_t bufsiz)
 
         for (;;) {
                 ispar = 0;
- if (yytoken == IDEN) {
+ if (yytoken == IDEN && nargs >= 0) {
                         for (argp = args; argp < &args[nargs]; ++argp) {
                                 if (*argp == yylval.sym)
                                         break;
Received on Fri Aug 21 2015 - 13:10:37 CEST

This archive was generated by hypermail 2.3.0 : Fri Aug 21 2015 - 13:12:27 CEST