@@ -4442,7 +4442,7 @@ PHP_PGSQL_API zend_result php_pgsql_meta_data(PGconn *pg_link, const zend_string
44424442 char * src , * tmp_name , * tmp_name2 = NULL ;
44434443 char * escaped ;
44444444 smart_str querystr = {0 };
4445- size_t new_len ;
4445+ size_t new_len , len ;
44464446 int i , num_rows ;
44474447 zval elem ;
44484448
@@ -4480,16 +4480,18 @@ PHP_PGSQL_API zend_result php_pgsql_meta_data(PGconn *pg_link, const zend_string
44804480 " JOIN pg_namespace n ON (c.relnamespace = n.oid) "
44814481 "WHERE a.attnum > 0 AND c.relname = '" );
44824482 }
4483- escaped = (char * )safe_emalloc (strlen (tmp_name2 ), 2 , 1 );
4484- new_len = PQescapeStringConn (pg_link , escaped , tmp_name2 , strlen (tmp_name2 ), NULL );
4483+ len = strlen (tmp_name2 );
4484+ escaped = (char * )safe_emalloc (len , 2 , 1 );
4485+ new_len = PQescapeStringConn (pg_link , escaped , tmp_name2 , len , NULL );
44854486 if (new_len ) {
44864487 smart_str_appendl (& querystr , escaped , new_len );
44874488 }
44884489 efree (escaped );
44894490
44904491 smart_str_appends (& querystr , "' AND n.nspname = '" );
4491- escaped = (char * )safe_emalloc (strlen (tmp_name ), 2 , 1 );
4492- new_len = PQescapeStringConn (pg_link , escaped , tmp_name , strlen (tmp_name ), NULL );
4492+ len = strlen (tmp_name );
4493+ escaped = (char * )safe_emalloc (len , 2 , 1 );
4494+ new_len = PQescapeStringConn (pg_link , escaped , tmp_name , len , NULL );
44934495 if (new_len ) {
44944496 smart_str_appendl (& querystr , escaped , new_len );
44954497 }
0 commit comments