mirror of
https://github.com/php/php-src.git
synced 2024-12-03 06:44:07 +08:00
Fixed crash with pg_escape_*()
# I'll MFH later.
This commit is contained in:
parent
e50a42f907
commit
186823957a
@ -2397,8 +2397,10 @@ PHP_FUNCTION(pg_escape_string)
|
||||
return;
|
||||
}
|
||||
|
||||
to = (char *)emalloc(len*2+1);
|
||||
len = (int)PQescapeString(to, from, strlen(from));
|
||||
if (len < 0) {
|
||||
efree(to);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
RETURN_STRINGL(to, len, 0);
|
||||
@ -2418,9 +2420,11 @@ PHP_FUNCTION(pg_escape_bytea)
|
||||
|
||||
to = (char *)PQescapeBytea((unsigned char*)from, strlen(from), (size_t *)&len);
|
||||
if (len < 0) {
|
||||
/* Don't need to free "to" here*/
|
||||
RETURN_FALSE;
|
||||
}
|
||||
RETURN_STRINGL(to, len, 0);
|
||||
RETURN_STRINGL(to, len, 1);
|
||||
free(to);
|
||||
}
|
||||
/* }}} */
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user