diff options
author | Stanislav Malyshev <stas@php.net> | 2016-11-05 13:20:24 -0700 |
---|---|---|
committer | Stanislav Malyshev <stas@php.net> | 2016-11-05 13:22:17 -0700 |
commit | 669763d88a8bb9707a45f0937a129b63a161d2f0 (patch) | |
tree | 88a1fc19403a330c9a50e7095ee0a8844445b993 /ext/pgsql/pgsql.c | |
parent | d858b4c77fa28ff9b0a597141a58f51803bafc2b (diff) | |
download | php-git-669763d88a8bb9707a45f0937a129b63a161d2f0.tar.gz |
More int->size_t and string overflow fixes
Diffstat (limited to 'ext/pgsql/pgsql.c')
-rw-r--r-- | ext/pgsql/pgsql.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c index 9ee81b1ac5..570e9ec735 100644 --- a/ext/pgsql/pgsql.c +++ b/ext/pgsql/pgsql.c @@ -1537,7 +1537,7 @@ PHP_FUNCTION(pg_connect_poll) if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &pgsql_link) == FAILURE) { return; } - + if ((pgsql = (PGconn *)zend_fetch_resource2(Z_RES_P(pgsql_link), "PostgreSQL link", le_link, le_plink)) == NULL) { RETURN_FALSE; } @@ -4356,7 +4356,7 @@ PHP_FUNCTION(pg_escape_string) break; } - to = zend_string_alloc(ZSTR_LEN(from) * 2, 0); + to = zend_string_safe_alloc(ZSTR_LEN(from), 2, 0, 0); #ifdef HAVE_PQESCAPE_CONN if (link) { if ((pgsql = (PGconn *)zend_fetch_resource2(link, "PostgreSQL link", le_link, le_plink)) == NULL) { @@ -4408,7 +4408,7 @@ PHP_FUNCTION(pg_escape_bytea) RETURN_FALSE; } to = (char *)PQescapeByteaConn(pgsql, (unsigned char *)from, (size_t)from_len, &to_len); - } else + } else #endif to = (char *)PQescapeBytea((unsigned char*)from, from_len, &to_len); |