arg.h: fixed argv checks order - geomyidae - A small C-based gopherd.
Log
Files
Refs
README
LICENSE
---
commit b002d13b34f69f0efc797b252f9db0878262581d
parent d22ff2f488be69cd455837b5dfdff0aad1aea812
Author: Hiltjo Posthuma 
Date:   Sun, 11 Jun 2017 19:49:06 +0200

arg.h: fixed argv checks order

This prevents accessing to a potentially out-of-bounds memory section.

Diffstat:
  arg.h                               |       4 ++--

1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/arg.h b/arg.h
@@ -6,8 +6,8 @@
 extern char *argv0;
 
 #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;\