php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #64812
Patch blenc.c.patch revision 2013-05-10 17:17 UTC by zenobic at gmail dot com

Patch blenc.c.patch for BLENC Bug #64812

Patch version 2013-05-10 17:17 UTC

Return to Bug #64812 | Download this patch
Patch Revisions:

Developer: zenobic@gmail.com

diff --git a/blenc.c b/../blenc-1.0.1alpha/blenc.c
index 69feb72..5b06d09 100644
--- a/blenc.c
+++ b/../blenc-1.0.1alpha/blenc.c
@@ -42,7 +42,7 @@ typedef struct _blenc_header {
 HashTable *php_bl_keys;
 
 /* {{{ blenc_functions[] */
-function_entry blenc_functions[] = {
+zend_function_entry blenc_functions[] = {
 	PHP_FE(blenc_encrypt,	NULL)
 	{NULL, NULL, NULL}	
 };
@@ -98,7 +98,7 @@ PHP_MINIT_FUNCTION(blenc)
 	REGISTER_INI_ENTRIES();
 	
 	php_bl_keys = pemalloc(sizeof(HashTable), TRUE);
-	zend_hash_init(php_bl_keys, 0, NULL, _php_blenc_pefree_wrapper, TRUE);
+	zend_hash_init(php_bl_keys, 0, NULL, (dtor_func_t) _php_blenc_pefree_wrapper, TRUE);
 	
 	zend_compile_file_old = zend_compile_file;
 	zend_compile_file = blenc_compile;
@@ -153,6 +153,7 @@ PHP_MINFO_FUNCTION(blenc)
 }
 /* }}} */
 
+
 PHP_FUNCTION(blenc_encrypt) {
 	
 	char *data = NULL,  *retval = NULL, *key = NULL, *output_file = NULL;
@@ -450,21 +451,26 @@ zend_op_array *blenc_compile(zend_file_handle *file_handle, int type TSRMLS_DC)
 	int i = 0;
 	size_t bytes;
 	char *script = NULL;
+	size_t len;
+	char *buf;
 	unsigned int index = 0;
 	unsigned int script_len = 0;
 	zend_op_array *retval = NULL;
 	
 	blenc_header *header;
-	
-	zend_stream_fixup(file_handle TSRMLS_CC);
+
+	if (zend_stream_fixup(file_handle, &buf, &len TSRMLS_CC) == FAILURE) {
+		return NULL;
+	}
 	
 	old_stream_reader = file_handle->handle.stream.reader;
 	old_stream_closer = file_handle->handle.stream.closer;
 	
 	file_handle->handle.stream.reader = blenc_stream_reader;
 	file_handle->handle.stream.closer = blenc_stream_closer;
+
+        script = emalloc(BLENC_BUFSIZE);
 	
-	script = emalloc(BLENC_BUFSIZE);
 	
 	for(i = 2; (bytes = old_stream_reader(file_handle->handle.stream.handle,
   					      &script[index],
@@ -538,7 +544,7 @@ zend_op_array *blenc_compile(zend_file_handle *file_handle, int type TSRMLS_DC)
 
 }
 
-void _php_blenc_pefree_wrapper(void **data)
+static void _php_blenc_pefree_wrapper(void **data)
 {	
 	pefree(*data, TRUE);
 	
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 15:01:29 2024 UTC