tony2001                Tue Jul 29 11:18:41 2008 UTC

  Modified files:              (Branch: PHP_5_3)
    /php-src/ext/phar   util.c 
  Log:
  don't segfault if given invalid/empty private key
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/phar/util.c?r1=1.55.2.26&r2=1.55.2.27&diff_format=u
Index: php-src/ext/phar/util.c
diff -u php-src/ext/phar/util.c:1.55.2.26 php-src/ext/phar/util.c:1.55.2.27
--- php-src/ext/phar/util.c:1.55.2.26   Tue Jul 29 11:09:00 2008
+++ php-src/ext/phar/util.c     Tue Jul 29 11:18:40 2008
@@ -18,7 +18,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: util.c,v 1.55.2.26 2008/07/29 11:09:00 tony2001 Exp $ */
+/* $Id: util.c,v 1.55.2.27 2008/07/29 11:18:40 tony2001 Exp $ */
 
 #include "phar_internal.h"
 
@@ -1902,6 +1902,13 @@
                        key = PEM_read_bio_PrivateKey(in, NULL,NULL, "");
 
                        BIO_free(in);
+                       if (!key) {
+                               if (error) {
+                                       spprintf(error, 0, "unable to process 
private key");
+                               }
+                               return FAILURE;
+                       }
+
                        siglen = EVP_PKEY_size(key);
                        sigbuf = emalloc(siglen + 1);
 



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

Reply via email to