]> granicus.if.org Git - php/commitdiff
MFH: Fixed bug #35594 (Multiple calls to getopt() may result in a crash).
authorIlia Alshanetsky <iliaa@php.net>
Thu, 8 Dec 2005 03:26:16 +0000 (03:26 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Thu, 8 Dec 2005 03:26:16 +0000 (03:26 +0000)
NEWS
ext/standard/basic_functions.c

diff --git a/NEWS b/NEWS
index 5dce0d5987c613f056b6d2dbd3fd49000a0bf403..29c1c93c8141ee3a3085282162f296141d7f74e9 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,8 @@ PHP 4                                                                      NEWS
 ?? ??? 2005, Version 4.4.2
 - Prevent header injection by limiting each header to a single line. (Ilia)
 - Fixed possible XSS inside error reporting functionality. (Ilia)
+- Fixed bug #35594 (Multiple calls to getopt() may result in a crash).
+  (rabbitt at gmail dot com, Ilia)
 - Fixed bug #35536 (mysql_field_type() doesn't handle NEWDECIMAL). (Tony)
 - Fixed bug #35410 (wddx_deserialize() doesn't handle large ints as keys 
   properly). (Ilia)
index bf9af8f580e73a59de86d093baf432a752ec0839..09badbc31fe59b68b0c7cb992d75aff9a9bbc9e0 100644 (file)
@@ -1595,6 +1595,9 @@ PHP_FUNCTION(getopt)
        /* Disable getopt()'s error messages. */
        opterr = 0;
 
+       /* Force reinitialization of getopt() (via optind reset) on every call. */
+       optind = 0;
+
        /* Invoke getopt(3) on the argument array. */
 #ifdef HARTMUT_0
        while ((o = getopt_long(argc, argv, options, longopts, &longindex)) != -1) {