cvs: php4(PHP_4_3) /ext/dba dba.c dba_cdb.c /ext/dba/libcdb cdb_make.c
| From: | Marcus Boerger | Date: | Wed, 16 Apr 2003 19:14:29 +0000 |
| Subject: | cvs: php4(PHP_4_3) /ext/dba dba.c dba_cdb.c /ext/dba/libcdb cdb_make.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-20332@lists.php.net to get a copy of this message | ||
helly Wed Apr 16 15:14:29 2003 EDT
Modified files: (Branch: PHP_4_3)
/php4/ext/dba dba.c dba_cdb.c
/php4/ext/dba/libcdb cdb_make.c
Log:
safe_emalloc()
Index: php4/ext/dba/dba.c
diff -u php4/ext/dba/dba.c:1.61.2.13 php4/ext/dba/dba.c:1.61.2.14
--- php4/ext/dba/dba.c:1.61.2.13 Sun Apr 13 16:16:14 2003
+++ php4/ext/dba/dba.c Wed Apr 16 15:14:29 2003
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: dba.c,v 1.61.2.13 2003/04/13 20:16:14 helly Exp $ */
+/* $Id: dba.c,v 1.61.2.14 2003/04/16 19:14:29 helly Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -382,7 +382,7 @@
}
/* we pass additional args to the respective handler */
- args = emalloc(ac * sizeof(zval *));
+ args = safe_emalloc(ac, sizeof(zval *), 0);
if (zend_get_parameters_array_ex(ac, args) != SUCCESS) {
FREENOW;
WRONG_PARAM_COUNT;
Index: php4/ext/dba/dba_cdb.c
diff -u php4/ext/dba/dba_cdb.c:1.23.2.5 php4/ext/dba/dba_cdb.c:1.23.2.6
--- php4/ext/dba/dba_cdb.c:1.23.2.5 Mon Apr 14 17:53:41 2003
+++ php4/ext/dba/dba_cdb.c Wed Apr 16 15:14:29 2003
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: dba_cdb.c,v 1.23.2.5 2003/04/14 21:53:41 helly Exp $ */
+/* $Id: dba_cdb.c,v 1.23.2.6 2003/04/16 19:14:29 helly Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -163,7 +163,7 @@
}
}
len = cdb_datalen(&cdb->c);
- new_entry = emalloc(len+1);
+ new_entry = safe_emalloc(len, 1, 1);
if (php_cdb_read(&cdb->c, new_entry, len, cdb_datapos(&cdb->c)) == -1) {
efree(new_entry);
@@ -268,7 +268,7 @@
uint32_unpack(buf, &klen);
uint32_unpack(buf + 4, &dlen);
- key = emalloc(klen + 1);
+ key = safe_emalloc(klen, 1, 1);
if (cdb_file_read(cdb->file, key, klen) < klen) {
efree(key);
key = NULL;
@@ -300,7 +300,7 @@
uint32_unpack(buf, &klen);
uint32_unpack(buf + 4, &dlen);
- key = emalloc(klen + 1);
+ key = safe_emalloc(klen, 1, 1);
if (cdb_file_read(cdb->file, key, klen) < klen) {
efree(key);
key = NULL;
Index: php4/ext/dba/libcdb/cdb_make.c
diff -u php4/ext/dba/libcdb/cdb_make.c:1.2.2.3 php4/ext/dba/libcdb/cdb_make.c:1.2.2.4
--- php4/ext/dba/libcdb/cdb_make.c:1.2.2.3 Fri Jan 31 15:10:11 2003
+++ php4/ext/dba/libcdb/cdb_make.c Wed Apr 16 15:14:29 2003
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: cdb_make.c,v 1.2.2.3 2003/01/31 20:10:11 helly Exp $ */
+/* $Id: cdb_make.c,v 1.2.2.4 2003/04/16 19:14:29 helly Exp $ */
/* incorporated from D.J.Bernstein's cdb-0.75 (http://cr.yp.to/cdb.html)*/
@@ -79,8 +79,7 @@
head = c->head;
if (!head || (head->num >= CDB_HPLIST)) {
- head = (struct cdb_hplist *)
- emalloc(sizeof(struct cdb_hplist));
+ head = (struct cdb_hplist *) emalloc(sizeof(struct cdb_hplist));
if (!head)
return -1;
head->num = 0;
@@ -172,8 +171,7 @@
return -1;
}
- c->split = (struct cdb_hp *)
- emalloc(memsize * sizeof(struct cdb_hp));
+ c->split = (struct cdb_hp *) safe_emalloc(memsize, sizeof(struct cdb_hp), 0);
if (!c->split)
return -1;
@@ -242,5 +240,5 @@
/* {{{ cdb_make_version */
char *cdb_make_version()
{
- return "0.75, $Revision: 1.2.2.3 $";
+ return "0.75, $Revision: 1.2.2.4 $";
}