diff options
author | Antony Dovgal <tony2001@php.net> | 2010-04-08 15:27:21 +0000 |
---|---|---|
committer | Antony Dovgal <tony2001@php.net> | 2010-04-08 15:27:21 +0000 |
commit | 6e66e426645938e0e00e00438223ac97d92bf7b0 (patch) | |
tree | 562b7d42451c25bae235978f258d696e834b35ce | |
parent | e665f1596213f7c62f5e8653c186346afb4d5ff2 (diff) | |
download | php-git-6e66e426645938e0e00e00438223ac97d92bf7b0.tar.gz |
make sure the actual length of the argument passed matches the
length of the argument declared
this fixes things like `php --zend-exten=1` or `php-fpm --fpm-con=conf`
-rw-r--r-- | main/getopt.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/main/getopt.c b/main/getopt.c index f3e1f2ed9c..2fd52d8d5a 100644 --- a/main/getopt.c +++ b/main/getopt.c @@ -107,9 +107,15 @@ PHPAPI int php_getopt(int argc, char* const *argv, const opt_struct opts[], char break; } } - optchr = 0; - dash = 0; - arg_start += strlen(opts[php_optidx].opt_name); + + if (arg_end == strlen(opts[php_optidx].opt_name)) { + optchr = 0; + dash = 0; + arg_start += strlen(opts[php_optidx].opt_name); + } else { + (*optind)++; + return (php_opt_error(argc, argv, *optind-1, optchr, OPTERRNF, show_err)); + } } else { if (!dash) { dash = 1; |