]> granicus.if.org Git - php/commitdiff
Fixed possible crash in apache_getenv()/apache_setenv() on invalid
authorIlia Alshanetsky <iliaa@php.net>
Mon, 2 Jan 2006 22:19:37 +0000 (22:19 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Mon, 2 Jan 2006 22:19:37 +0000 (22:19 +0000)
parameters.

NEWS
sapi/apache2handler/php_functions.c

diff --git a/NEWS b/NEWS
index 41e74c1cc06b8ef7ed38cfa4af958d77ea5b951e..bd988d9b1a25ddb9808f664df1ee188843f4d368 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,8 @@ PHP                                                                        NEWS
 ?? Jan 2006, PHP 5.1.2RC2
 - Added constants for libxslt and libexslt versions: LIBXSLT_VERSION,
   LIBXSLT_DOTTED_VERSION, LIBEXSLT_VERSION and LIBEXSLT_DOTTED_VERSION. (Pierre)
+- Fixed possible crash in apache_getenv()/apache_setenv() on invalid parameters.
+  (Ilia)
 - Changed errors to warnings in imagecolormatch(). (Pierre)
 - Fixed segfault/leak in imagecolormatch(). (Pierre)
 - Fixed small leak in mysqli_stmt_fetch() when bound variable was empty string.
index fc987ec53199a163f3f7d5852b3e71eb62d9f316..2df54c5d4552d78b2d2293743642dc005529e105 100644 (file)
@@ -264,10 +264,13 @@ PHP_FUNCTION(apache_setenv)
        ctx = SG(server_context);
 
        r = ctx->r;
-       if (arg_count == 3 && Z_STRVAL_PP(walk_to_top)) {
-               while(r->prev) {
-                       r = r->prev;
-               }       
+       if (arg_count == 3) {
+               convert_to_boolean_ex(walk_to_top);
+               if (Z_LVAL_PP(walk_to_top)) {
+                       while(r->prev) {
+                               r = r->prev;
+                       }
+               }
        }
 
        convert_to_string_ex(variable);
@@ -300,10 +303,13 @@ PHP_FUNCTION(apache_getenv)
        ctx = SG(server_context);
 
        r = ctx->r;
-       if (arg_count == 2 && Z_STRVAL_PP(walk_to_top)) {
-               while(r->prev) {
-                       r = r->prev;
-               }       
+       if (arg_count == 2) {
+               convert_to_boolean_ex(walk_to_top);
+               if (Z_LVAL_PP(walk_to_top)) {
+                       while(r->prev) {
+                               r = r->prev;
+                       }
+               }
        }
 
        convert_to_string_ex(variable);