cvs: ZendEngine2 / zend_alloc.c

From: Date: Sat, 30 Sep 2006 17:17:31 +0000
Subject: cvs: ZendEngine2 / zend_alloc.c
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-5286@lists.php.net to get a copy of this message
iliaa Sat Sep 30 17:17:31 2006 UTC Modified files: /ZendEngine2 zend_alloc.c Log: MFB: Added safety checks against integer overflow. http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_alloc.c?r1=1.161&r2=1.162&diff_format=u Index: ZendEngine2/zend_alloc.c diff -u ZendEngine2/zend_alloc.c:1.161 ZendEngine2/zend_alloc.c:1.162 --- ZendEngine2/zend_alloc.c:1.161 Thu Sep 14 08:55:17 2006 +++ ZendEngine2/zend_alloc.c Sat Sep 30 17:17:31 2006 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_alloc.c,v 1.161 2006/09/14 08:55:17 dmitry Exp $ */ +/* $Id: zend_alloc.c,v 1.162 2006/09/30 17:17:31 iliaa Exp $ */ #include "zend.h" #include "zend_alloc.h" @@ -1730,13 +1730,12 @@ ZEND_API void *_ecalloc(size_t nmemb, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) { void *p; - int final_size = size*nmemb; - p = _emalloc(final_size ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC); + p = _safe_emalloc(nmemb, size, 0 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC); if (!p) { return (void *) p; } - memset(p, 0, final_size); + memset(p, 0, size * nmemb); return p; }

« previous php.zend-engine.cvs (#5286) next »