Skip to content

Commit 230aea0

Browse files
author
Ilia Alshanetsky
committed
MFH: Corrected string escape calculation.
1 parent 8080b6b commit 230aea0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ext/sqlite/sqlite.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1736,7 +1736,7 @@ PHP_FUNCTION(sqlite_escape_string)
17361736
/* binary string */
17371737
int enclen;
17381738

1739-
ret = emalloc( 1 + 5 + stringlen * (256 / 253) );
1739+
ret = emalloc( 1 + 5 + stringlen * ((float) 256 / (float) 253) );
17401740
ret[0] = '\x01';
17411741
enclen = sqlite_encode_binary((const unsigned char*)string, stringlen, ret+1);
17421742
RETVAL_STRINGL(ret, enclen+1, 0);
@@ -1941,7 +1941,7 @@ PHP_FUNCTION(sqlite_udf_encode_binary)
19411941
int enclen;
19421942
char *ret;
19431943

1944-
ret = emalloc( 1 + 5 + datalen * (256 / 253) );
1944+
ret = emalloc( 1 + 5 + datalen * ((float) 256 / (float) 253) );
19451945
ret[0] = '\x01';
19461946
enclen = sqlite_encode_binary((const unsigned char*)data, datalen, ret+1);
19471947
RETVAL_STRINGL(ret, enclen+1, 0);

0 commit comments

Comments
 (0)