commit bbacab561ce953c1e4620d5a42334ca9e9701331
parent ee8701d501325c74bbbd294da4142e3cbfc988fe
Author: Lucas Gabriel Vuotto <l.vuotto92@gmail.com>
Date: Fri, 19 Feb 2016 15:59:49 -0300
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@gmail.com>
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arg.h b/arg.h
@@ -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_;\