summaryrefslogtreecommitdiff
path: root/ext/sqlite/sqlite.c
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2004-03-09 01:09:35 +0000
committerIlia Alshanetsky <iliaa@php.net>2004-03-09 01:09:35 +0000
commit7bc8bdec79e6acb3b4588224304eac690f9d0694 (patch)
tree1e2ad17839b581ab897217d3bcf6f74695f4854c /ext/sqlite/sqlite.c
parente375ffddb457cd25695c46a720b20f5a8f70ccd7 (diff)
downloadphp-git-7bc8bdec79e6acb3b4588224304eac690f9d0694.tar.gz
Change float operations to safe_emalloc().
Original idea by Sascha (see sess_sqlite.c)
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 9ba406c16b..545a919dc5 100644
--- a/ext/sqlite/sqlite.c
+++ b/ext/sqlite/sqlite.c
@@ -2612,7 +2612,7 @@ PHP_FUNCTION(sqlite_escape_string)
/* binary string */
int enclen;
- ret = emalloc( 1 + 5 + stringlen * ((float) 256 / (float) 253) );
+ ret = safe_emalloc(1 + stringlen / 254, 257, 3);
ret[0] = '\x01';
enclen = php_sqlite_encode_binary(string, stringlen, ret+1);
RETVAL_STRINGL(ret, enclen+1, 0);
@@ -2842,7 +2842,7 @@ PHP_FUNCTION(sqlite_udf_encode_binary)
int enclen;
char *ret;
- ret = emalloc( 1 + 5 + datalen * ((float) 256 / (float) 253) );
+ ret = safe_emalloc(1 + datalen / 254, 257, 3);
ret[0] = '\x01';
enclen = php_sqlite_encode_binary(data, datalen, ret+1);
RETVAL_STRINGL(ret, enclen+1, 0);