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

From: <git_AT_suckless.org>
Date: Mon, 18 Jul 2016 18:06:45 +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 Mon Jul 18 2016 - 18:06:45 CEST

This archive was generated by hypermail 2.3.0 : Mon Jul 18 2016 - 18:13:25 CEST