cvs: php4 /ext/dbase dbase.c
| From: | Sterling Hughes | Date: | Fri, 30 Jun 2000 22:44:20 +0000 |
| Subject: | cvs: php4 /ext/dbase dbase.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-575@lists.php.net to get a copy of this message | ||
sterling Fri Jun 30 15:44:20 2000 EDT
Modified files:
/php4/ext/dbase dbase.c
Log:
Fix bug 4813. Fixed by greg@darkphoton.com
Index: php4/ext/dbase/dbase.c
diff -u php4/ext/dbase/dbase.c:1.27 php4/ext/dbase/dbase.c:1.28
--- php4/ext/dbase/dbase.c:1.27 Fri Jun 30 14:21:17 2000
+++ php4/ext/dbase/dbase.c Fri Jun 30 15:44:20 2000
@@ -617,7 +617,20 @@
dbh->db_hlen = sizeof(struct dbf_dhead) + 2 + num_fields * sizeof(struct dbf_dfield);
rlen = 1;
-
+ /**
+ * Patch by greg@darkphoton.com
+ **/
+ /* make sure that the db_format entries for all fields are set to NULL to ensure we
+ don't seg fault if there's an error and we need to call free_dbf_head() before all
+ fields have been defined. */
+ for (i = 0, cur_f = dbf; i < num_fields; i++, cur_f++) {
+ cur_f->db_format = NULL;
+ }
+ /**
+ * end patch
+ */
+
+
for (i = 0, cur_f = dbf; i < num_fields; i++, cur_f++) {
/* look up the first field */
if (zend_hash_index_find(fields->value.ht, i, (void **)&value) == FAILURE) {