summaryrefslogtreecommitdiff
path: root/ext/sqlite/sqlite.c
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2010-04-28 12:10:10 +0000
committerIlia Alshanetsky <iliaa@php.net>2010-04-28 12:10:10 +0000
commit5031bfc395bd9cc5a29389d5fe458c3452643b76 (patch)
tree7a4fa7ee5e10f531a6cfe7e45e562660d1357e08 /ext/sqlite/sqlite.c
parent07446082c86ad21833006c2aa86cb6cc60cd25ad (diff)
downloadphp-git-5031bfc395bd9cc5a29389d5fe458c3452643b76.tar.gz
Fixed a possible arbitrary memory access inside sqlite extension. Reported by Mateusz Kocielski.
Diffstat (limited to 'ext/sqlite/sqlite.c')
-rw-r--r--ext/sqlite/sqlite.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/sqlite/sqlite.c b/ext/sqlite/sqlite.c
index 4017dc7fbc..5fc562eeab 100644
--- a/ext/sqlite/sqlite.c
+++ b/ext/sqlite/sqlite.c
@@ -2508,7 +2508,7 @@ PHP_FUNCTION(sqlite_array_query)
return;
}
- rres = (struct php_sqlite_result *)emalloc(sizeof(*rres));
+ rres = (struct php_sqlite_result *)ecalloc(1, sizeof(*rres));
sqlite_query(NULL, db, sql, sql_len, (int)mode, 0, NULL, &rres, NULL TSRMLS_CC);
if (db->last_err_code != SQLITE_OK) {
if (rres) {
@@ -2624,7 +2624,7 @@ PHP_FUNCTION(sqlite_single_query)
return;
}
- rres = (struct php_sqlite_result *)emalloc(sizeof(*rres));
+ rres = (struct php_sqlite_result *)ecalloc(1, sizeof(*rres));
sqlite_query(NULL, db, sql, sql_len, PHPSQLITE_NUM, 0, NULL, &rres, NULL TSRMLS_CC);
if (db->last_err_code != SQLITE_OK) {
if (rres) {