Browse Source

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>
Signed-off-by: Christoph Lohmann <20h@r-36.net>
master
Lucas Gabriel Vuotto 9 years ago
committed by Christoph Lohmann
parent
commit
4fdba860c8
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      arg.h

+ 2
- 2
arg.h View File

@ -10,8 +10,8 @@ extern char *argv0;
/* use main(int argc, char *argv[]) */ /* use main(int argc, char *argv[]) */
#define ARGBEGIN for (argv0 = *argv, argv++, argc--;\ #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++) {\ argc--, argv++) {\
char argc_;\ char argc_;\
char **argv_;\ char **argv_;\


Loading…
Cancel
Save