bjori           Wed May  7 20:02:42 2008 UTC

  Modified files:              (Branch: PHP_5_2)
    /php-src/ext/standard       streamsfuncs.c 
  Log:
  MFH: Fixed bug #44712 (stream_context_set_params segfaults on invalid
  arguments).
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/streamsfuncs.c?r1=1.58.2.6.2.20&r2=1.58.2.6.2.21&diff_format=u
Index: php-src/ext/standard/streamsfuncs.c
diff -u php-src/ext/standard/streamsfuncs.c:1.58.2.6.2.20 
php-src/ext/standard/streamsfuncs.c:1.58.2.6.2.21
--- php-src/ext/standard/streamsfuncs.c:1.58.2.6.2.20   Sun May  4 21:19:18 2008
+++ php-src/ext/standard/streamsfuncs.c Wed May  7 20:02:42 2008
@@ -17,7 +17,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: streamsfuncs.c,v 1.58.2.6.2.20 2008/05/04 21:19:18 colder Exp $ */
+/* $Id: streamsfuncs.c,v 1.58.2.6.2.21 2008/05/07 20:02:42 bjori Exp $ */
 
 #include "php.h"
 #include "php_globals.h"
@@ -879,7 +879,7 @@
        return ret;
 }
 
-static int parse_context_params(php_stream_context *context, zval *params)
+static int parse_context_params(php_stream_context *context, zval *params 
TSRMLS_DC)
 {
        int ret = SUCCESS;
        zval **tmp;
@@ -898,7 +898,11 @@
                context->notifier->dtor = user_space_stream_notifier_dtor;
        }
        if (SUCCESS == zend_hash_find(Z_ARRVAL_P(params), "options", 
sizeof("options"), (void**)&tmp)) {
-               parse_context_options(context, *tmp);
+               if (Z_TYPE_PP(tmp) == IS_ARRAY) {
+                       parse_context_options(context, *tmp);
+               } else {
+                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid 
stream/context parameter");
+               }
        }
        
        return ret;
@@ -1006,7 +1010,7 @@
                RETURN_FALSE;
        }
 
-       RETVAL_BOOL(parse_context_params(context, params) == SUCCESS);
+       RETVAL_BOOL(parse_context_params(context, params TSRMLS_CC) == SUCCESS);
 }
 /* }}} */
 



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to