iliaa           Fri Jan  2 20:43:58 2009 UTC

  Modified files:              
    /php-src/ext/phar   phar.c 
  Log:
  
  MFB: Fixed a possible crash when phar_create_signature() fails
  
http://cvs.php.net/viewvc.cgi/php-src/ext/phar/phar.c?r1=1.393&r2=1.394&diff_format=u
Index: php-src/ext/phar/phar.c
diff -u php-src/ext/phar/phar.c:1.393 php-src/ext/phar/phar.c:1.394
--- php-src/ext/phar/phar.c:1.393       Wed Dec 31 11:12:35 2008
+++ php-src/ext/phar/phar.c     Fri Jan  2 20:43:58 2009
@@ -17,7 +17,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: phar.c,v 1.393 2008/12/31 11:12:35 sebastian Exp $ */
+/* $Id: phar.c,v 1.394 2009/01/02 20:43:58 iliaa Exp $ */
 
 #define PHAR_MAIN 1
 #include "phar_internal.h"
@@ -3122,7 +3122,7 @@
                                return EOF;
 #endif
                        default: {
-                               char *digest;
+                               char *digest = NULL;
                                int digest_len;
 
                                if (FAILURE == phar_create_signature(phar, 
newfile, &digest, &digest_len, error TSRMLS_CC)) {
@@ -3131,7 +3131,9 @@
                                                spprintf(error, 0, "phar error: 
unable to write signature: %s", save);
                                                efree(save);
                                        }
-                                       efree(digest);
+                                       if (digest) {
+                                               efree(digest);
+                                       }
                                        if (closeoldfile) {
                                                php_stream_close(oldfile);
                                        }
@@ -3624,7 +3626,7 @@
        php_info_print_table_header(2, "Phar: PHP Archive support", "enabled");
        php_info_print_table_row(2, "Phar EXT version", PHP_PHAR_VERSION);
        php_info_print_table_row(2, "Phar API version", PHP_PHAR_API_VERSION);
-       php_info_print_table_row(2, "CVS revision", "$Revision: 1.393 $");
+       php_info_print_table_row(2, "CVS revision", "$Revision: 1.394 $");
        php_info_print_table_row(2, "Phar-based phar archives", "enabled");
        php_info_print_table_row(2, "Tar-based phar archives", "enabled");
        php_info_print_table_row(2, "ZIP-based phar archives", "enabled");



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

Reply via email to