iliaa           Tue Dec 26 17:33:12 2006 UTC

  Modified files:              (Branch: PHP_4_4)
    /Zend       zend_ini.c zend_ini.h 
    /php-src/ext/exif   exif.c 
    /php-src/main       main.c 
  Log:
  MFB: safety checks
  
  
http://cvs.php.net/viewvc.cgi/Zend/zend_ini.c?r1=1.23.2.7.2.2&r2=1.23.2.7.2.3&diff_format=u
Index: Zend/zend_ini.c
diff -u Zend/zend_ini.c:1.23.2.7.2.2 Zend/zend_ini.c:1.23.2.7.2.3
--- Zend/zend_ini.c:1.23.2.7.2.2        Wed Sep  6 08:53:56 2006
+++ Zend/zend_ini.c     Tue Dec 26 17:33:11 2006
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: zend_ini.c,v 1.23.2.7.2.2 2006/09/06 08:53:56 dmitry Exp $ */
+/* $Id: zend_ini.c,v 1.23.2.7.2.3 2006/12/26 17:33:11 iliaa Exp $ */
 
 #include "zend.h"
 #include "zend_qsort.h"
@@ -530,6 +530,28 @@
 #endif
 
        if (new_value && !new_value[0]) {
+ZEND_API ZEND_INI_MH(OnUpdateLongGEZero)
+{
+       long *p, tmp;
+#ifndef ZTS
+       char *base = (char *) mh_arg2;
+#else
+       char *base;
+
+       base = (char *) ts_resource(*((int *) mh_arg2));
+#endif
+
+       tmp = zend_atoi(new_value, new_value_length);
+       if (tmp < 0) {
+               return FAILURE;
+       }
+
+       p = (long *) (base+(size_t) mh_arg1);
+       *p = tmp;
+
+       return SUCCESS;
+}
+
                return FAILURE;
        }
 
http://cvs.php.net/viewvc.cgi/Zend/zend_ini.h?r1=1.21.2.2&r2=1.21.2.2.2.1&diff_format=u
Index: Zend/zend_ini.h
diff -u Zend/zend_ini.h:1.21.2.2 Zend/zend_ini.h:1.21.2.2.2.1
--- Zend/zend_ini.h:1.21.2.2    Sun Jan  9 17:00:16 2005
+++ Zend/zend_ini.h     Tue Dec 26 17:33:12 2006
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: zend_ini.h,v 1.21.2.2 2005/01/09 17:00:16 sniper Exp $ */
+/* $Id: zend_ini.h,v 1.21.2.2.2.1 2006/12/26 17:33:12 iliaa Exp $ */
 
 #ifndef ZEND_INI_H
 #define ZEND_INI_H
@@ -175,6 +175,7 @@
 BEGIN_EXTERN_C()
 ZEND_API ZEND_INI_MH(OnUpdateBool);
 ZEND_API ZEND_INI_MH(OnUpdateInt);
+ZEND_API ZEND_INI_MH(OnUpdateLongGEZero);
 ZEND_API ZEND_INI_MH(OnUpdateReal);
 ZEND_API ZEND_INI_MH(OnUpdateString);
 ZEND_API ZEND_INI_MH(OnUpdateStringUnempty);
http://cvs.php.net/viewvc.cgi/php-src/ext/exif/exif.c?r1=1.118.2.37.2.4&r2=1.118.2.37.2.5&diff_format=u
Index: php-src/ext/exif/exif.c
diff -u php-src/ext/exif/exif.c:1.118.2.37.2.4 
php-src/ext/exif/exif.c:1.118.2.37.2.5
--- php-src/ext/exif/exif.c:1.118.2.37.2.4      Sun Jan  1 13:46:52 2006
+++ php-src/ext/exif/exif.c     Tue Dec 26 17:33:12 2006
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: exif.c,v 1.118.2.37.2.4 2006/01/01 13:46:52 sniper Exp $ */
+/* $Id: exif.c,v 1.118.2.37.2.5 2006/12/26 17:33:12 iliaa Exp $ */
 
 /*  ToDos
  *
@@ -107,7 +107,7 @@
 };
 /* }}} */
 
-#define EXIF_VERSION "1.4 $Id: exif.c,v 1.118.2.37.2.4 2006/01/01 13:46:52 
sniper Exp $"
+#define EXIF_VERSION "1.4 $Id: exif.c,v 1.118.2.37.2.5 2006/12/26 17:33:12 
iliaa Exp $"
 
 /* {{{ PHP_MINFO_FUNCTION
  */
@@ -3536,7 +3536,7 @@
                                                                
exif_error_docref(NULL TSRMLS_CC, ImageInfo, E_NOTICE, "%s THUMBNAIL @0x%04X + 
0x%04X", ImageInfo->Thumbnail.data ? "ignore" : "read", 
ImageInfo->Thumbnail.offset, ImageInfo->Thumbnail.size);
 #endif
                                                                if 
(!ImageInfo->Thumbnail.data) {
-                                                                       
ImageInfo->Thumbnail.data = emalloc(ImageInfo->Thumbnail.size);
+                                                                       
ImageInfo->Thumbnail.data = safe_emalloc(ImageInfo->Thumbnail.size, 1, 0);
                                                                        
php_stream_seek(ImageInfo->infile, ImageInfo->Thumbnail.offset, SEEK_SET);
                                                                        fgot = 
php_stream_read(ImageInfo->infile, ImageInfo->Thumbnail.data, 
ImageInfo->Thumbnail.size);
                                                                        if 
(fgot < ImageInfo->Thumbnail.size) {
@@ -3569,7 +3569,7 @@
                                        exif_error_docref(NULL TSRMLS_CC, 
ImageInfo, E_NOTICE, "%s THUMBNAIL @0x%04X + 0x%04X", ImageInfo->Thumbnail.data 
? "ignore" : "read", ImageInfo->Thumbnail.offset, ImageInfo->Thumbnail.size);
 #endif
                                        if (!ImageInfo->Thumbnail.data && 
ImageInfo->Thumbnail.offset && ImageInfo->Thumbnail.size && 
ImageInfo->read_thumbnail) {
-                                               ImageInfo->Thumbnail.data = 
emalloc(ImageInfo->Thumbnail.size);
+                                               ImageInfo->Thumbnail.data = 
safe_emalloc(ImageInfo->Thumbnail.size, 1, 0);
                                                
php_stream_seek(ImageInfo->infile, ImageInfo->Thumbnail.offset, SEEK_SET);
                                                fgot = 
php_stream_read(ImageInfo->infile, ImageInfo->Thumbnail.data, 
ImageInfo->Thumbnail.size);
                                                if (fgot < 
ImageInfo->Thumbnail.size) {
http://cvs.php.net/viewvc.cgi/php-src/main/main.c?r1=1.512.2.63.2.11&r2=1.512.2.63.2.12&diff_format=u
Index: php-src/main/main.c
diff -u php-src/main/main.c:1.512.2.63.2.11 php-src/main/main.c:1.512.2.63.2.12
--- php-src/main/main.c:1.512.2.63.2.11 Thu May 18 22:36:14 2006
+++ php-src/main/main.c Tue Dec 26 17:33:12 2006
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: main.c,v 1.512.2.63.2.11 2006/05/18 22:36:14 tony2001 Exp $ */
+/* $Id: main.c,v 1.512.2.63.2.12 2006/12/26 17:33:12 iliaa Exp $ */
 
 /* {{{ includes
  */
@@ -132,8 +132,13 @@
  */
 static PHP_INI_MH(OnSetPrecision)
 {
-       EG(precision) = atoi(new_value);
-       return SUCCESS;
+       int i = atoi(new_value);
+       if (i >= 0) {
+               EG(precision) = i;
+               return SUCCESS;
+       } else {
+               return FAILURE;
+}
 }
 /* }}} */
 
@@ -312,7 +317,7 @@
        STD_PHP_INI_BOOLEAN("y2k_compliance",           "1",            
PHP_INI_ALL,            OnUpdateBool,                   y2k_compliance,         
        php_core_globals,       core_globals)
 
        STD_PHP_INI_ENTRY("unserialize_callback_func",  NULL,   PHP_INI_ALL,    
        OnUpdateString,                 unserialize_callback_func,      
php_core_globals,       core_globals)
-       STD_PHP_INI_ENTRY("serialize_precision",        "100",  PHP_INI_ALL,    
        OnUpdateInt,                    serialize_precision,    
php_core_globals,       core_globals)
+       STD_PHP_INI_ENTRY("serialize_precision",        "100",  PHP_INI_ALL,    
        OnUpdateLongGEZero,                     serialize_precision,    
php_core_globals,       core_globals)
        STD_PHP_INI_ENTRY("arg_separator.output",       "&",            
PHP_INI_ALL,            OnUpdateStringUnempty,  arg_separator.output,   
php_core_globals,       core_globals)
        STD_PHP_INI_ENTRY("arg_separator.input",        "&",            
PHP_INI_SYSTEM|PHP_INI_PERDIR,  OnUpdateStringUnempty,  arg_separator.input,    
php_core_globals,       core_globals)
 

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

Reply via email to