steinm Tue Oct 14 03:49:35 2003 EDT
Modified files:
/php-src/ext/dbase dbase.c
Log:
- limit writing of field data to field len + 1
This fixed many memory overrun errors which appeared
in several scripts when writing a record.
Index: php-src/ext/dbase/dbase.c
diff -u php-src/ext/dbase/dbase.c:1.69 php-src/ext/dbase/dbase.c:1.70
--- php-src/ext/dbase/dbase.c:1.69 Sun Sep 21 09:17:20 2003
+++ php-src/ext/dbase/dbase.c Tue Oct 14 03:49:34 2003
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: dbase.c,v 1.69 2003/09/21 13:17:20 steinm Exp $ */
+/* $Id: dbase.c,v 1.70 2003/10/14 07:49:34 steinm Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -294,7 +294,7 @@
tmp = **field;
zval_copy_ctor(&tmp);
convert_to_string(&tmp);
- sprintf(t_cp, cur_f->db_format, Z_STRVAL(tmp));
+ snprintf(t_cp, cur_f->db_flen+1, cur_f->db_format, Z_STRVAL(tmp));
zval_dtor(&tmp);
t_cp += cur_f->db_flen;
}
@@ -306,7 +306,7 @@
RETURN_FALSE;
}
- put_dbf_info(dbh);
+ put_dbf_info(dbh);
efree(cp);
RETURN_TRUE;
@@ -361,7 +361,7 @@
RETURN_FALSE;
}
convert_to_string_ex(field);
- sprintf(t_cp, cur_f->db_format, Z_STRVAL_PP(field));
+ snprintf(t_cp, cur_f->db_flen+1, cur_f->db_format,
Z_STRVAL_PP(field));
t_cp += cur_f->db_flen;
}
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php