[hackers] [scc] [cc2] Fix case of return without expression || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Tue, 12 Jul 2016 15:51:15 +0200 (CEST)

commit 52f26ada8dedab3823cf9dc42625391830bf9619
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Tue Jul 12 15:50:27 2016 +0200
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Tue Jul 12 15:50:27 2016 +0200

    [cc2] Fix case of return without expression
    
    eval is no longer detecting if the input token
    is null, and in the case of return this
    situation can happen, and it has happening.

diff --git a/cc2/parser.c b/cc2/parser.c
index fa1eae0..5a6d3f7 100644
--- a/cc2/parser.c
+++ b/cc2/parser.c
_AT_@ -329,7 +329,9 @@ oreturn(char *token, union tokenop u)
 {
         Node *np = newnode(u.op);
 
- eval(strtok(NULL, "\t\n"));
+ token = strtok(NULL, "\t\n");
+ if (token)
+ eval(strtok(NULL, "\t\n"));
         if (!empty())
                 np->left = pop();
         push(np);
Received on Tue Jul 12 2016 - 15:51:15 CEST

This archive was generated by hypermail 2.3.0 : Tue Jul 12 2016 - 16:00:18 CEST