[hackers] [ubase] arg.h: fixed argv checks order || Lucas Gabriel Vuotto

From: <git_AT_suckless.org>
Date: Mon, 22 Feb 2016 15:36:25 +0100 (CET)

commit 0e7ab0ca9e1769d9c5e004378f14c9a7daf4e343
Author: Lucas Gabriel Vuotto <l.vuotto92_AT_gmail.com>
AuthorDate: Mon Feb 22 11:03:36 2016 -0300
Commit: sin <sin_AT_2f30.org>
CommitDate: Mon Feb 22 14:36:21 2016 +0000

    arg.h: fixed argv checks order
    
    This prevents accessing to a potentially out-of-bounds memory section.
    
    Signed-off-by: Lucas Gabriel Vuotto <l.vuotto92_AT_gmail.com>

diff --git a/arg.h b/arg.h
index 4df77a7..aeab52a 100644
--- a/arg.h
+++ b/arg.h
_AT_@ -10,8 +10,8 @@ extern char *argv0;
 
 /* use main(int argc, char *argv[]) */
 #define ARGBEGIN for (argv0 = *argv, argv++, argc--;\
- argv[0] && argv[0][1]\
- && argv[0][0] == '-';\
+ argv[0] && argv[0][0] == '-'\
+ && argv[0][1];\
                                         argc--, argv++) {\
                                 char argc_;\
                                 char **argv_;\
Received on Mon Feb 22 2016 - 15:36:25 CET

This archive was generated by hypermail 2.3.0 : Mon Feb 22 2016 - 15:48:12 CET