pajoye          Sat Jul 29 22:24:48 2006 UTC

  Added files:                 
    /php-src/ext/openssl/tests  bug38255.phpt 

  Modified files:              
    /php-src/ext/openssl        openssl.c 
  Log:
  - MFH: #38255, fix possible leak in php_openssl_evp_from_zval
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/openssl/openssl.c?r1=1.107&r2=1.108&diff_format=u
Index: php-src/ext/openssl/openssl.c
diff -u php-src/ext/openssl/openssl.c:1.107 php-src/ext/openssl/openssl.c:1.108
--- php-src/ext/openssl/openssl.c:1.107 Sat Jul 29 21:54:45 2006
+++ php-src/ext/openssl/openssl.c       Sat Jul 29 22:24:48 2006
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: openssl.c,v 1.107 2006/07/29 21:54:45 pajoye Exp $ */
+/* $Id: openssl.c,v 1.108 2006/07/29 22:24:48 pajoye Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -1824,6 +1824,9 @@
                return NULL;
        } else {
                /* force it to be a string and check if it refers to a file */
+               if (Z_TYPE_PP(val) == IS_LONG || Z_TYPE_PP(val) == IS_BOOL) {
+                       return NULL;
+               }
                convert_to_string_ex(val);
 
                if (Z_STRLEN_PP(val) > 7 && memcmp(Z_STRVAL_PP(val), "file://", 
sizeof("file://") - 1) == 0) {

http://cvs.php.net/viewvc.cgi/php-src/ext/openssl/tests/bug38255.phpt?view=markup&rev=1.1
Index: php-src/ext/openssl/tests/bug38255.phpt
+++ php-src/ext/openssl/tests/bug38255.phpt
--TEST--
openssl key from zval leaks 
--SKIPIF--
<?php 
if (!extension_loaded("openssl")) die("skip"); 
?>
--FILE--
<?php
$pub_key_id = false; 
$signature = '';
$ok = openssl_verify("foo", $signature, $pub_key_id, OPENSSL_ALGO_MD5);
?>
--EXPECTF--
Warning: openssl_verify(): supplied key param cannot be coerced into a public 
key in %s/bug38255.php on line %d 

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

Reply via email to