idx int64 | func_before string | Vulnerability Classification string | vul int64 | func_after string | patch string | CWE ID string | lines_before string | lines_after string |
|---|---|---|---|---|---|---|---|---|
4,100 | PHP_FUNCTION(pg_set_client_encoding)
{
char *encoding;
size_t encoding_len;
zval *pgsql_link = NULL;
int id = -1, argc = ZEND_NUM_ARGS();
PGconn *pgsql;
if (argc == 1) {
if (zend_parse_parameters(argc, "s", &encoding, &encoding_len) == FAILURE) {
return;
}
id = FETCH_DEFAULT_LINK();
CHECK_DEFAULT_LINK... | DoS | 0 | PHP_FUNCTION(pg_set_client_encoding)
{
char *encoding;
size_t encoding_len;
zval *pgsql_link = NULL;
int id = -1, argc = ZEND_NUM_ARGS();
PGconn *pgsql;
if (argc == 1) {
if (zend_parse_parameters(argc, "s", &encoding, &encoding_len) == FAILURE) {
return;
}
id = FETCH_DEFAULT_LINK();
CHECK_DEFAULT_LINK... | @@ -6445,6 +6445,9 @@ static inline void build_tablename(smart_str *querystr, PGconn *pg_link, const c
/* schame.table should be "schame"."table" */
table_copy = estrdup(table);
token = php_strtok_r(table_copy, ".", &tmp);
+ if (token == NULL) {
+ token = table;
+ }
... | null | null | null |
4,101 | PHP_FUNCTION(pg_client_encoding)
{
zval *pgsql_link = NULL;
int id = -1, argc = ZEND_NUM_ARGS();
PGconn *pgsql;
if (zend_parse_parameters(argc, "|r", &pgsql_link) == FAILURE) {
return;
}
if (argc == 0) {
id = FETCH_DEFAULT_LINK();
CHECK_DEFAULT_LINK(id);
}
if (pgsql_link == NULL && id == -1) {
RETUR... | DoS | 0 | PHP_FUNCTION(pg_client_encoding)
{
zval *pgsql_link = NULL;
int id = -1, argc = ZEND_NUM_ARGS();
PGconn *pgsql;
if (zend_parse_parameters(argc, "|r", &pgsql_link) == FAILURE) {
return;
}
if (argc == 0) {
id = FETCH_DEFAULT_LINK();
CHECK_DEFAULT_LINK(id);
}
if (pgsql_link == NULL && id == -1) {
RETUR... | @@ -6445,6 +6445,9 @@ static inline void build_tablename(smart_str *querystr, PGconn *pg_link, const c
/* schame.table should be "schame"."table" */
table_copy = estrdup(table);
token = php_strtok_r(table_copy, ".", &tmp);
+ if (token == NULL) {
+ token = table;
+ }
... | null | null | null |
4,102 | PHP_FUNCTION(pg_end_copy)
{
zval *pgsql_link = NULL;
int id = -1, argc = ZEND_NUM_ARGS();
PGconn *pgsql;
int result = 0;
if (zend_parse_parameters(argc, "|r", &pgsql_link) == FAILURE) {
return;
}
if (argc == 0) {
id = FETCH_DEFAULT_LINK();
CHECK_DEFAULT_LINK(id);
}
if (pgsql_link == NULL && id == -1)... | DoS | 0 | PHP_FUNCTION(pg_end_copy)
{
zval *pgsql_link = NULL;
int id = -1, argc = ZEND_NUM_ARGS();
PGconn *pgsql;
int result = 0;
if (zend_parse_parameters(argc, "|r", &pgsql_link) == FAILURE) {
return;
}
if (argc == 0) {
id = FETCH_DEFAULT_LINK();
CHECK_DEFAULT_LINK(id);
}
if (pgsql_link == NULL && id == -1)... | @@ -6445,6 +6445,9 @@ static inline void build_tablename(smart_str *querystr, PGconn *pg_link, const c
/* schame.table should be "schame"."table" */
table_copy = estrdup(table);
token = php_strtok_r(table_copy, ".", &tmp);
+ if (token == NULL) {
+ token = table;
+ }
... | null | null | null |
4,103 | PHP_FUNCTION(pg_copy_to)
{
zval *pgsql_link;
char *table_name, *pg_delim = NULL, *pg_null_as = NULL;
size_t table_name_len, pg_delim_len, pg_null_as_len, free_pg_null = 0;
char *query;
int id = -1;
PGconn *pgsql;
PGresult *pgsql_result;
ExecStatusType status;
int copydone = 0;
#if !HAVE_PQGETCOPYDATA
char cop... | DoS | 0 | PHP_FUNCTION(pg_copy_to)
{
zval *pgsql_link;
char *table_name, *pg_delim = NULL, *pg_null_as = NULL;
size_t table_name_len, pg_delim_len, pg_null_as_len, free_pg_null = 0;
char *query;
int id = -1;
PGconn *pgsql;
PGresult *pgsql_result;
ExecStatusType status;
int copydone = 0;
#if !HAVE_PQGETCOPYDATA
char cop... | @@ -6445,6 +6445,9 @@ static inline void build_tablename(smart_str *querystr, PGconn *pg_link, const c
/* schame.table should be "schame"."table" */
table_copy = estrdup(table);
token = php_strtok_r(table_copy, ".", &tmp);
+ if (token == NULL) {
+ token = table;
+ }
... | null | null | null |
4,104 | PHP_FUNCTION(pg_copy_from)
{
zval *pgsql_link = NULL, *pg_rows;
zval *tmp;
char *table_name, *pg_delim = NULL, *pg_null_as = NULL;
size_t table_name_len, pg_delim_len, pg_null_as_len;
int pg_null_as_free = 0;
char *query;
int id = -1;
PGconn *pgsql;
PGresult *pgsql_result;
ExecStatusType status;
int argc =... | DoS | 0 | PHP_FUNCTION(pg_copy_from)
{
zval *pgsql_link = NULL, *pg_rows;
zval *tmp;
char *table_name, *pg_delim = NULL, *pg_null_as = NULL;
size_t table_name_len, pg_delim_len, pg_null_as_len;
int pg_null_as_free = 0;
char *query;
int id = -1;
PGconn *pgsql;
PGresult *pgsql_result;
ExecStatusType status;
int argc =... | @@ -6445,6 +6445,9 @@ static inline void build_tablename(smart_str *querystr, PGconn *pg_link, const c
/* schame.table should be "schame"."table" */
table_copy = estrdup(table);
token = php_strtok_r(table_copy, ".", &tmp);
+ if (token == NULL) {
+ token = table;
+ }
... | null | null | null |
4,105 | PHP_FUNCTION(pg_escape_string)
{
zend_string *from = NULL, *to = NULL;
zval *pgsql_link;
#ifdef HAVE_PQESCAPE_CONN
PGconn *pgsql;
#endif
int id = -1;
switch (ZEND_NUM_ARGS()) {
case 1:
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &from) == FAILURE) {
return;
}
pgsql_link = NULL;
id = FETCH_DE... | DoS | 0 | PHP_FUNCTION(pg_escape_string)
{
zend_string *from = NULL, *to = NULL;
zval *pgsql_link;
#ifdef HAVE_PQESCAPE_CONN
PGconn *pgsql;
#endif
int id = -1;
switch (ZEND_NUM_ARGS()) {
case 1:
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &from) == FAILURE) {
return;
}
pgsql_link = NULL;
id = FETCH_DE... | @@ -6445,6 +6445,9 @@ static inline void build_tablename(smart_str *querystr, PGconn *pg_link, const c
/* schame.table should be "schame"."table" */
table_copy = estrdup(table);
token = php_strtok_r(table_copy, ".", &tmp);
+ if (token == NULL) {
+ token = table;
+ }
... | null | null | null |
4,106 | PHP_FUNCTION(pg_escape_bytea)
{
char *from = NULL, *to = NULL;
size_t to_len;
size_t from_len;
int id = -1;
#ifdef HAVE_PQESCAPE_BYTEA_CONN
PGconn *pgsql;
#endif
zval *pgsql_link;
switch (ZEND_NUM_ARGS()) {
case 1:
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &from, &from_len) == FAILURE) {
return;
... | DoS | 0 | PHP_FUNCTION(pg_escape_bytea)
{
char *from = NULL, *to = NULL;
size_t to_len;
size_t from_len;
int id = -1;
#ifdef HAVE_PQESCAPE_BYTEA_CONN
PGconn *pgsql;
#endif
zval *pgsql_link;
switch (ZEND_NUM_ARGS()) {
case 1:
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &from, &from_len) == FAILURE) {
return;
... | @@ -6445,6 +6445,9 @@ static inline void build_tablename(smart_str *querystr, PGconn *pg_link, const c
/* schame.table should be "schame"."table" */
table_copy = estrdup(table);
token = php_strtok_r(table_copy, ".", &tmp);
+ if (token == NULL) {
+ token = table;
+ }
... | null | null | null |
4,107 | PHP_FUNCTION(pg_unescape_bytea)
{
char *from = NULL, *to = NULL, *tmp = NULL;
size_t to_len;
size_t from_len;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s",
&from, &from_len) == FAILURE) {
return;
}
#if HAVE_PQUNESCAPEBYTEA
tmp = (char *)PQunescapeBytea((unsigned char*)from, &to_len);
to = estrndup(... | DoS | 0 | PHP_FUNCTION(pg_unescape_bytea)
{
char *from = NULL, *to = NULL, *tmp = NULL;
size_t to_len;
size_t from_len;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s",
&from, &from_len) == FAILURE) {
return;
}
#if HAVE_PQUNESCAPEBYTEA
tmp = (char *)PQunescapeBytea((unsigned char*)from, &to_len);
to = estrndup(... | @@ -6445,6 +6445,9 @@ static inline void build_tablename(smart_str *querystr, PGconn *pg_link, const c
/* schame.table should be "schame"."table" */
table_copy = estrdup(table);
token = php_strtok_r(table_copy, ".", &tmp);
+ if (token == NULL) {
+ token = table;
+ }
... | null | null | null |
4,108 | PHP_FUNCTION(pg_escape_identifier)
{
php_pgsql_escape_internal(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
}
| DoS | 0 | PHP_FUNCTION(pg_escape_identifier)
{
php_pgsql_escape_internal(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
}
| @@ -6445,6 +6445,9 @@ static inline void build_tablename(smart_str *querystr, PGconn *pg_link, const c
/* schame.table should be "schame"."table" */
table_copy = estrdup(table);
token = php_strtok_r(table_copy, ".", &tmp);
+ if (token == NULL) {
+ token = table;
+ }
... | null | null | null |
4,109 | PHP_FUNCTION(pg_result_error)
{
zval *result;
PGresult *pgsql_result;
pgsql_result_handle *pg_result;
char *err = NULL;
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "r",
&result) == FAILURE) {
RETURN_FALSE;
}
ZEND_FETCH_RESOURCE(pg_result, pgsql_result_handle *, result, -1... | DoS | 0 | PHP_FUNCTION(pg_result_error)
{
zval *result;
PGresult *pgsql_result;
pgsql_result_handle *pg_result;
char *err = NULL;
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "r",
&result) == FAILURE) {
RETURN_FALSE;
}
ZEND_FETCH_RESOURCE(pg_result, pgsql_result_handle *, result, -1... | @@ -6445,6 +6445,9 @@ static inline void build_tablename(smart_str *querystr, PGconn *pg_link, const c
/* schame.table should be "schame"."table" */
table_copy = estrdup(table);
token = php_strtok_r(table_copy, ".", &tmp);
+ if (token == NULL) {
+ token = table;
+ }
... | null | null | null |
4,110 | PHP_FUNCTION(pg_result_error_field)
{
zval *result;
zend_long fieldcode;
PGresult *pgsql_result;
pgsql_result_handle *pg_result;
char *field = NULL;
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "rl",
&result, &fieldcode) == FAILURE) {
RETURN_FALSE;
}
ZEND_FETCH_RESOURCE(p... | DoS | 0 | PHP_FUNCTION(pg_result_error_field)
{
zval *result;
zend_long fieldcode;
PGresult *pgsql_result;
pgsql_result_handle *pg_result;
char *field = NULL;
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "rl",
&result, &fieldcode) == FAILURE) {
RETURN_FALSE;
}
ZEND_FETCH_RESOURCE(p... | @@ -6445,6 +6445,9 @@ static inline void build_tablename(smart_str *querystr, PGconn *pg_link, const c
/* schame.table should be "schame"."table" */
table_copy = estrdup(table);
token = php_strtok_r(table_copy, ".", &tmp);
+ if (token == NULL) {
+ token = table;
+ }
... | null | null | null |
4,111 | PHP_FUNCTION(pg_connection_status)
{
zval *pgsql_link = NULL;
int id = -1;
PGconn *pgsql;
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "r",
&pgsql_link) == FAILURE) {
RETURN_FALSE;
}
ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, "PostgreSQL link", le_link, le_plink);... | DoS | 0 | PHP_FUNCTION(pg_connection_status)
{
zval *pgsql_link = NULL;
int id = -1;
PGconn *pgsql;
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "r",
&pgsql_link) == FAILURE) {
RETURN_FALSE;
}
ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, "PostgreSQL link", le_link, le_plink);... | @@ -6445,6 +6445,9 @@ static inline void build_tablename(smart_str *querystr, PGconn *pg_link, const c
/* schame.table should be "schame"."table" */
table_copy = estrdup(table);
token = php_strtok_r(table_copy, ".", &tmp);
+ if (token == NULL) {
+ token = table;
+ }
... | null | null | null |
4,112 | PHP_FUNCTION(pg_transaction_status)
{
zval *pgsql_link = NULL;
int id = -1;
PGconn *pgsql;
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "r",
&pgsql_link) == FAILURE) {
RETURN_FALSE;
}
ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, "PostgreSQL link", le_link, le_plink)... | DoS | 0 | PHP_FUNCTION(pg_transaction_status)
{
zval *pgsql_link = NULL;
int id = -1;
PGconn *pgsql;
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "r",
&pgsql_link) == FAILURE) {
RETURN_FALSE;
}
ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, "PostgreSQL link", le_link, le_plink)... | @@ -6445,6 +6445,9 @@ static inline void build_tablename(smart_str *querystr, PGconn *pg_link, const c
/* schame.table should be "schame"."table" */
table_copy = estrdup(table);
token = php_strtok_r(table_copy, ".", &tmp);
+ if (token == NULL) {
+ token = table;
+ }
... | null | null | null |
4,113 | PHP_FUNCTION(pg_connection_reset)
{
zval *pgsql_link;
int id = -1;
PGconn *pgsql;
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "r",
&pgsql_link) == FAILURE) {
RETURN_FALSE;
}
ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, "PostgreSQL link", le_link, le_plink);
PQr... | DoS | 0 | PHP_FUNCTION(pg_connection_reset)
{
zval *pgsql_link;
int id = -1;
PGconn *pgsql;
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "r",
&pgsql_link) == FAILURE) {
RETURN_FALSE;
}
ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, "PostgreSQL link", le_link, le_plink);
PQr... | @@ -6445,6 +6445,9 @@ static inline void build_tablename(smart_str *querystr, PGconn *pg_link, const c
/* schame.table should be "schame"."table" */
table_copy = estrdup(table);
token = php_strtok_r(table_copy, ".", &tmp);
+ if (token == NULL) {
+ token = table;
+ }
... | null | null | null |
4,114 | PHP_FUNCTION(pg_cancel_query)
{
php_pgsql_do_async(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_PG_ASYNC_REQUEST_CANCEL);
}
| DoS | 0 | PHP_FUNCTION(pg_cancel_query)
{
php_pgsql_do_async(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_PG_ASYNC_REQUEST_CANCEL);
}
| @@ -6445,6 +6445,9 @@ static inline void build_tablename(smart_str *querystr, PGconn *pg_link, const c
/* schame.table should be "schame"."table" */
table_copy = estrdup(table);
token = php_strtok_r(table_copy, ".", &tmp);
+ if (token == NULL) {
+ token = table;
+ }
... | null | null | null |
4,115 | PHP_FUNCTION(pg_connection_busy)
{
php_pgsql_do_async(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_PG_ASYNC_IS_BUSY);
}
| DoS | 0 | PHP_FUNCTION(pg_connection_busy)
{
php_pgsql_do_async(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_PG_ASYNC_IS_BUSY);
}
| @@ -6445,6 +6445,9 @@ static inline void build_tablename(smart_str *querystr, PGconn *pg_link, const c
/* schame.table should be "schame"."table" */
table_copy = estrdup(table);
token = php_strtok_r(table_copy, ".", &tmp);
+ if (token == NULL) {
+ token = table;
+ }
... | null | null | null |
4,116 | PHP_FUNCTION(pg_send_query)
{
zval *pgsql_link;
char *query;
size_t len;
int id = -1;
PGconn *pgsql;
int is_non_blocking;
int ret;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs", &pgsql_link, &query, &len) == FAILURE) {
return;
}
ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, "PostgreSQL link", le... | DoS | 0 | PHP_FUNCTION(pg_send_query)
{
zval *pgsql_link;
char *query;
size_t len;
int id = -1;
PGconn *pgsql;
int is_non_blocking;
int ret;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs", &pgsql_link, &query, &len) == FAILURE) {
return;
}
ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, "PostgreSQL link", le... | @@ -6445,6 +6445,9 @@ static inline void build_tablename(smart_str *querystr, PGconn *pg_link, const c
/* schame.table should be "schame"."table" */
table_copy = estrdup(table);
token = php_strtok_r(table_copy, ".", &tmp);
+ if (token == NULL) {
+ token = table;
+ }
... | null | null | null |
4,117 | PHP_FUNCTION(pg_send_query_params)
{
zval *pgsql_link, *pv_param_arr, *tmp;
int num_params = 0;
char **params = NULL;
char *query;
size_t query_len;
int id = -1;
PGconn *pgsql;
int is_non_blocking;
int ret;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rsa/", &pgsql_link, &query, &query_len, &pv_param_arr) == ... | DoS | 0 | PHP_FUNCTION(pg_send_query_params)
{
zval *pgsql_link, *pv_param_arr, *tmp;
int num_params = 0;
char **params = NULL;
char *query;
size_t query_len;
int id = -1;
PGconn *pgsql;
int is_non_blocking;
int ret;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rsa/", &pgsql_link, &query, &query_len, &pv_param_arr) == ... | @@ -6445,6 +6445,9 @@ static inline void build_tablename(smart_str *querystr, PGconn *pg_link, const c
/* schame.table should be "schame"."table" */
table_copy = estrdup(table);
token = php_strtok_r(table_copy, ".", &tmp);
+ if (token == NULL) {
+ token = table;
+ }
... | null | null | null |
4,118 | PHP_FUNCTION(pg_send_prepare)
{
zval *pgsql_link;
char *query, *stmtname;
size_t stmtname_len, query_len;
int id = -1;
PGconn *pgsql;
int is_non_blocking;
int ret;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rss", &pgsql_link, &stmtname, &stmtname_len, &query, &query_len) == FAILURE) {
return;
}
if (pgsql... | DoS | 0 | PHP_FUNCTION(pg_send_prepare)
{
zval *pgsql_link;
char *query, *stmtname;
size_t stmtname_len, query_len;
int id = -1;
PGconn *pgsql;
int is_non_blocking;
int ret;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rss", &pgsql_link, &stmtname, &stmtname_len, &query, &query_len) == FAILURE) {
return;
}
if (pgsql... | @@ -6445,6 +6445,9 @@ static inline void build_tablename(smart_str *querystr, PGconn *pg_link, const c
/* schame.table should be "schame"."table" */
table_copy = estrdup(table);
token = php_strtok_r(table_copy, ".", &tmp);
+ if (token == NULL) {
+ token = table;
+ }
... | null | null | null |
4,119 | PHP_FUNCTION(pg_send_execute)
{
zval *pgsql_link;
zval *pv_param_arr, *tmp;
int num_params = 0;
char **params = NULL;
char *stmtname;
size_t stmtname_len;
int id = -1;
PGconn *pgsql;
int is_non_blocking;
int ret;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rsa", &pgsql_link, &stmtname, &stmtname_len, &pv_pa... | DoS | 0 | PHP_FUNCTION(pg_send_execute)
{
zval *pgsql_link;
zval *pv_param_arr, *tmp;
int num_params = 0;
char **params = NULL;
char *stmtname;
size_t stmtname_len;
int id = -1;
PGconn *pgsql;
int is_non_blocking;
int ret;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rsa", &pgsql_link, &stmtname, &stmtname_len, &pv_pa... | @@ -6445,6 +6445,9 @@ static inline void build_tablename(smart_str *querystr, PGconn *pg_link, const c
/* schame.table should be "schame"."table" */
table_copy = estrdup(table);
token = php_strtok_r(table_copy, ".", &tmp);
+ if (token == NULL) {
+ token = table;
+ }
... | null | null | null |
4,120 | PHP_FUNCTION(pg_get_result)
{
zval *pgsql_link;
int id = -1;
PGconn *pgsql;
PGresult *pgsql_result;
pgsql_result_handle *pg_result;
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "r", &pgsql_link) == FAILURE) {
RETURN_FALSE;
}
ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, "Po... | DoS | 0 | PHP_FUNCTION(pg_get_result)
{
zval *pgsql_link;
int id = -1;
PGconn *pgsql;
PGresult *pgsql_result;
pgsql_result_handle *pg_result;
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "r", &pgsql_link) == FAILURE) {
RETURN_FALSE;
}
ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, "Po... | @@ -6445,6 +6445,9 @@ static inline void build_tablename(smart_str *querystr, PGconn *pg_link, const c
/* schame.table should be "schame"."table" */
table_copy = estrdup(table);
token = php_strtok_r(table_copy, ".", &tmp);
+ if (token == NULL) {
+ token = table;
+ }
... | null | null | null |
4,121 | PHP_FUNCTION(pg_get_notify)
{
zval *pgsql_link;
int id = -1;
zend_long result_type = PGSQL_ASSOC;
PGconn *pgsql;
PGnotify *pgsql_notify;
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "r|l",
&pgsql_link, &result_type) == FAILURE) {
RETURN_FALSE;
}
ZEND_FETCH_RESOURCE2(pgsql,... | DoS | 0 | PHP_FUNCTION(pg_get_notify)
{
zval *pgsql_link;
int id = -1;
zend_long result_type = PGSQL_ASSOC;
PGconn *pgsql;
PGnotify *pgsql_notify;
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "r|l",
&pgsql_link, &result_type) == FAILURE) {
RETURN_FALSE;
}
ZEND_FETCH_RESOURCE2(pgsql,... | @@ -6445,6 +6445,9 @@ static inline void build_tablename(smart_str *querystr, PGconn *pg_link, const c
/* schame.table should be "schame"."table" */
table_copy = estrdup(table);
token = php_strtok_r(table_copy, ".", &tmp);
+ if (token == NULL) {
+ token = table;
+ }
... | null | null | null |
4,122 | PHP_FUNCTION(pg_get_pid)
{
zval *pgsql_link;
int id = -1;
PGconn *pgsql;
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "r",
&pgsql_link) == FAILURE) {
RETURN_FALSE;
}
ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, "PostgreSQL link", le_link, le_plink);
RETURN_LONG(PQ... | DoS | 0 | PHP_FUNCTION(pg_get_pid)
{
zval *pgsql_link;
int id = -1;
PGconn *pgsql;
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "r",
&pgsql_link) == FAILURE) {
RETURN_FALSE;
}
ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, "PostgreSQL link", le_link, le_plink);
RETURN_LONG(PQ... | @@ -6445,6 +6445,9 @@ static inline void build_tablename(smart_str *querystr, PGconn *pg_link, const c
/* schame.table should be "schame"."table" */
table_copy = estrdup(table);
token = php_strtok_r(table_copy, ".", &tmp);
+ if (token == NULL) {
+ token = table;
+ }
... | null | null | null |
4,123 | PHP_FUNCTION(pg_socket)
{
zval *pgsql_link;
php_stream *stream;
PGconn *pgsql;
int id = -1;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &pgsql_link) == FAILURE) {
return;
}
ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, "PostgreSQL link", le_link, le_plink);
stream = php_stream_alloc(&php_stream... | DoS | 0 | PHP_FUNCTION(pg_socket)
{
zval *pgsql_link;
php_stream *stream;
PGconn *pgsql;
int id = -1;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &pgsql_link) == FAILURE) {
return;
}
ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, "PostgreSQL link", le_link, le_plink);
stream = php_stream_alloc(&php_stream... | @@ -6445,6 +6445,9 @@ static inline void build_tablename(smart_str *querystr, PGconn *pg_link, const c
/* schame.table should be "schame"."table" */
table_copy = estrdup(table);
token = php_strtok_r(table_copy, ".", &tmp);
+ if (token == NULL) {
+ token = table;
+ }
... | null | null | null |
4,124 | PHP_FUNCTION(pg_consume_input)
{
zval *pgsql_link;
int id = -1;
PGconn *pgsql;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &pgsql_link) == FAILURE) {
return;
}
ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, "PostgreSQL link", le_link, le_plink);
RETURN_BOOL(PQconsumeInput(pgsql));
}
| DoS | 0 | PHP_FUNCTION(pg_consume_input)
{
zval *pgsql_link;
int id = -1;
PGconn *pgsql;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &pgsql_link) == FAILURE) {
return;
}
ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, "PostgreSQL link", le_link, le_plink);
RETURN_BOOL(PQconsumeInput(pgsql));
}
| @@ -6445,6 +6445,9 @@ static inline void build_tablename(smart_str *querystr, PGconn *pg_link, const c
/* schame.table should be "schame"."table" */
table_copy = estrdup(table);
token = php_strtok_r(table_copy, ".", &tmp);
+ if (token == NULL) {
+ token = table;
+ }
... | null | null | null |
4,125 | PHP_FUNCTION(pg_flush)
{
zval *pgsql_link;
int id = -1;
PGconn *pgsql;
int ret;
int is_non_blocking;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &pgsql_link) == FAILURE) {
return;
}
ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, "PostgreSQL link", le_link, le_plink);
is_non_blocking = PQisnonbl... | DoS | 0 | PHP_FUNCTION(pg_flush)
{
zval *pgsql_link;
int id = -1;
PGconn *pgsql;
int ret;
int is_non_blocking;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &pgsql_link) == FAILURE) {
return;
}
ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, "PostgreSQL link", le_link, le_plink);
is_non_blocking = PQisnonbl... | @@ -6445,6 +6445,9 @@ static inline void build_tablename(smart_str *querystr, PGconn *pg_link, const c
/* schame.table should be "schame"."table" */
table_copy = estrdup(table);
token = php_strtok_r(table_copy, ".", &tmp);
+ if (token == NULL) {
+ token = table;
+ }
... | null | null | null |
4,126 | PHP_FUNCTION(pg_meta_data)
{
zval *pgsql_link;
char *table_name;
size_t table_name_len;
zend_bool extended=0;
PGconn *pgsql;
int id = -1;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs|b",
&pgsql_link, &table_name, &table_name_len, &extended) == FAILURE) {
return;
}
ZEND_FETCH_RESOURCE2(pgsql, PGc... | DoS | 0 | PHP_FUNCTION(pg_meta_data)
{
zval *pgsql_link;
char *table_name;
size_t table_name_len;
zend_bool extended=0;
PGconn *pgsql;
int id = -1;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs|b",
&pgsql_link, &table_name, &table_name_len, &extended) == FAILURE) {
return;
}
ZEND_FETCH_RESOURCE2(pgsql, PGc... | @@ -6445,6 +6445,9 @@ static inline void build_tablename(smart_str *querystr, PGconn *pg_link, const c
/* schame.table should be "schame"."table" */
table_copy = estrdup(table);
token = php_strtok_r(table_copy, ".", &tmp);
+ if (token == NULL) {
+ token = table;
+ }
... | null | null | null |
4,127 | PHP_FUNCTION(pg_convert)
{
zval *pgsql_link, *values;
char *table_name;
size_t table_name_len;
zend_ulong option = 0;
PGconn *pg_link;
int id = -1;
if (zend_parse_parameters(ZEND_NUM_ARGS(),
"rsa|l", &pgsql_link, &table_name, &table_name_len, &values, &option) == FAILURE) {
return;
}
if (option & ~... | DoS | 0 | PHP_FUNCTION(pg_convert)
{
zval *pgsql_link, *values;
char *table_name;
size_t table_name_len;
zend_ulong option = 0;
PGconn *pg_link;
int id = -1;
if (zend_parse_parameters(ZEND_NUM_ARGS(),
"rsa|l", &pgsql_link, &table_name, &table_name_len, &values, &option) == FAILURE) {
return;
}
if (option & ~... | @@ -6445,6 +6445,9 @@ static inline void build_tablename(smart_str *querystr, PGconn *pg_link, const c
/* schame.table should be "schame"."table" */
table_copy = estrdup(table);
token = php_strtok_r(table_copy, ".", &tmp);
+ if (token == NULL) {
+ token = table;
+ }
... | null | null | null |
4,128 | PHP_FUNCTION(pg_insert)
{
zval *pgsql_link, *values;
char *table;
size_t table_len;
zend_ulong option = PGSQL_DML_EXEC, return_sql;
PGconn *pg_link;
PGresult *pg_result;
ExecStatusType status;
pgsql_result_handle *pgsql_handle;
zend_string *sql = NULL;
int id = -1, argc = ZEND_NUM_ARGS();
if (zend_parse_par... | DoS | 0 | PHP_FUNCTION(pg_insert)
{
zval *pgsql_link, *values;
char *table;
size_t table_len;
zend_ulong option = PGSQL_DML_EXEC, return_sql;
PGconn *pg_link;
PGresult *pg_result;
ExecStatusType status;
pgsql_result_handle *pgsql_handle;
zend_string *sql = NULL;
int id = -1, argc = ZEND_NUM_ARGS();
if (zend_parse_par... | @@ -6445,6 +6445,9 @@ static inline void build_tablename(smart_str *querystr, PGconn *pg_link, const c
/* schame.table should be "schame"."table" */
table_copy = estrdup(table);
token = php_strtok_r(table_copy, ".", &tmp);
+ if (token == NULL) {
+ token = table;
+ }
... | null | null | null |
4,129 | PHP_FUNCTION(pg_update)
{
zval *pgsql_link, *values, *ids;
char *table;
size_t table_len;
zend_ulong option = PGSQL_DML_EXEC;
PGconn *pg_link;
zend_string *sql = NULL;
int id = -1, argc = ZEND_NUM_ARGS();
if (zend_parse_parameters(argc, "rsaa|l",
&pgsql_link, &table, &table_len, &values, &ids, &optio... | DoS | 0 | PHP_FUNCTION(pg_update)
{
zval *pgsql_link, *values, *ids;
char *table;
size_t table_len;
zend_ulong option = PGSQL_DML_EXEC;
PGconn *pg_link;
zend_string *sql = NULL;
int id = -1, argc = ZEND_NUM_ARGS();
if (zend_parse_parameters(argc, "rsaa|l",
&pgsql_link, &table, &table_len, &values, &ids, &optio... | @@ -6445,6 +6445,9 @@ static inline void build_tablename(smart_str *querystr, PGconn *pg_link, const c
/* schame.table should be "schame"."table" */
table_copy = estrdup(table);
token = php_strtok_r(table_copy, ".", &tmp);
+ if (token == NULL) {
+ token = table;
+ }
... | null | null | null |
4,130 | PHP_FUNCTION(pg_delete)
{
zval *pgsql_link, *ids;
char *table;
size_t table_len;
zend_ulong option = PGSQL_DML_EXEC;
PGconn *pg_link;
zend_string *sql;
int id = -1, argc = ZEND_NUM_ARGS();
if (zend_parse_parameters(argc, "rsa|l",
&pgsql_link, &table, &table_len, &ids, &option) == FAILURE) {
return;
... | DoS | 0 | PHP_FUNCTION(pg_delete)
{
zval *pgsql_link, *ids;
char *table;
size_t table_len;
zend_ulong option = PGSQL_DML_EXEC;
PGconn *pg_link;
zend_string *sql;
int id = -1, argc = ZEND_NUM_ARGS();
if (zend_parse_parameters(argc, "rsa|l",
&pgsql_link, &table, &table_len, &ids, &option) == FAILURE) {
return;
... | @@ -6445,6 +6445,9 @@ static inline void build_tablename(smart_str *querystr, PGconn *pg_link, const c
/* schame.table should be "schame"."table" */
table_copy = estrdup(table);
token = php_strtok_r(table_copy, ".", &tmp);
+ if (token == NULL) {
+ token = table;
+ }
... | null | null | null |
4,131 | PHP_FUNCTION(pg_select)
{
zval *pgsql_link, *ids;
char *table;
size_t table_len;
zend_ulong option = PGSQL_DML_EXEC;
PGconn *pg_link;
zend_string *sql = NULL;
int id = -1, argc = ZEND_NUM_ARGS();
if (zend_parse_parameters(argc, "rsa|l",
&pgsql_link, &table, &table_len, &ids, &option) == FAILURE) {
r... | DoS | 0 | PHP_FUNCTION(pg_select)
{
zval *pgsql_link, *ids;
char *table;
size_t table_len;
zend_ulong option = PGSQL_DML_EXEC;
PGconn *pg_link;
zend_string *sql = NULL;
int id = -1, argc = ZEND_NUM_ARGS();
if (zend_parse_parameters(argc, "rsa|l",
&pgsql_link, &table, &table_len, &ids, &option) == FAILURE) {
r... | @@ -6445,6 +6445,9 @@ static inline void build_tablename(smart_str *querystr, PGconn *pg_link, const c
/* schame.table should be "schame"."table" */
table_copy = estrdup(table);
token = php_strtok_r(table_copy, ".", &tmp);
+ if (token == NULL) {
+ token = table;
+ }
... | null | null | null |
4,132 | PHP_MINFO_FUNCTION(pgsql)
{
char buf[256];
php_info_print_table_start();
php_info_print_table_header(2, "PostgreSQL Support", "enabled");
#if HAVE_PG_CONFIG_H
php_info_print_table_row(2, "PostgreSQL(libpq) Version", PG_VERSION);
php_info_print_table_row(2, "PostgreSQL(libpq) ", PG_VERSION_STR);
#ifdef HAVE_PGSQL_... | DoS | 0 | PHP_MINFO_FUNCTION(pgsql)
{
char buf[256];
php_info_print_table_start();
php_info_print_table_header(2, "PostgreSQL Support", "enabled");
#if HAVE_PG_CONFIG_H
php_info_print_table_row(2, "PostgreSQL(libpq) Version", PG_VERSION);
php_info_print_table_row(2, "PostgreSQL(libpq) ", PG_VERSION_STR);
#ifdef HAVE_PGSQL_... | @@ -6445,6 +6445,9 @@ static inline void build_tablename(smart_str *querystr, PGconn *pg_link, const c
/* schame.table should be "schame"."table" */
table_copy = estrdup(table);
token = php_strtok_r(table_copy, ".", &tmp);
+ if (token == NULL) {
+ token = table;
+ }
... | null | null | null |
4,133 | PHP_MINIT_FUNCTION(pgsql)
{
REGISTER_INI_ENTRIES();
le_link = zend_register_list_destructors_ex(_close_pgsql_link, NULL, "pgsql link", module_number);
le_plink = zend_register_list_destructors_ex(NULL, _close_pgsql_plink, "pgsql link persistent", module_number);
le_result = zend_register_list_destructors_ex(_free_... | DoS | 0 | PHP_MINIT_FUNCTION(pgsql)
{
REGISTER_INI_ENTRIES();
le_link = zend_register_list_destructors_ex(_close_pgsql_link, NULL, "pgsql link", module_number);
le_plink = zend_register_list_destructors_ex(NULL, _close_pgsql_plink, "pgsql link persistent", module_number);
le_result = zend_register_list_destructors_ex(_free_... | @@ -6445,6 +6445,9 @@ static inline void build_tablename(smart_str *querystr, PGconn *pg_link, const c
/* schame.table should be "schame"."table" */
table_copy = estrdup(table);
token = php_strtok_r(table_copy, ".", &tmp);
+ if (token == NULL) {
+ token = table;
+ }
... | null | null | null |
4,134 | PHP_RINIT_FUNCTION(pgsql)
{
PGG(default_link) = NULL;
PGG(num_links) = PGG(num_persistent);
return SUCCESS;
}
| DoS | 0 | PHP_RINIT_FUNCTION(pgsql)
{
PGG(default_link) = NULL;
PGG(num_links) = PGG(num_persistent);
return SUCCESS;
}
| @@ -6445,6 +6445,9 @@ static inline void build_tablename(smart_str *querystr, PGconn *pg_link, const c
/* schame.table should be "schame"."table" */
table_copy = estrdup(table);
token = php_strtok_r(table_copy, ".", &tmp);
+ if (token == NULL) {
+ token = table;
+ }
... | null | null | null |
4,135 | PHP_RSHUTDOWN_FUNCTION(pgsql)
{
/* clean up notice messages */
zend_hash_clean(&PGG(notices));
/* clean up persistent connection */
zend_hash_apply(&EG(persistent_list), (apply_func_t) _rollback_transactions);
return SUCCESS;
}
| DoS | 0 | PHP_RSHUTDOWN_FUNCTION(pgsql)
{
/* clean up notice messages */
zend_hash_clean(&PGG(notices));
/* clean up persistent connection */
zend_hash_apply(&EG(persistent_list), (apply_func_t) _rollback_transactions);
return SUCCESS;
}
| @@ -6445,6 +6445,9 @@ static inline void build_tablename(smart_str *querystr, PGconn *pg_link, const c
/* schame.table should be "schame"."table" */
table_copy = estrdup(table);
token = php_strtok_r(table_copy, ".", &tmp);
+ if (token == NULL) {
+ token = table;
+ }
... | null | null | null |
4,136 | static void _close_pgsql_plink(zend_resource *rsrc)
{
PGconn *link = (PGconn *)rsrc->ptr;
PGresult *res;
while ((res = PQgetResult(link))) {
PQclear(res);
}
PQfinish(link);
PGG(num_persistent)--;
PGG(num_links)--;
}
| DoS | 0 | static void _close_pgsql_plink(zend_resource *rsrc)
{
PGconn *link = (PGconn *)rsrc->ptr;
PGresult *res;
while ((res = PQgetResult(link))) {
PQclear(res);
}
PQfinish(link);
PGG(num_persistent)--;
PGG(num_links)--;
}
| @@ -6445,6 +6445,9 @@ static inline void build_tablename(smart_str *querystr, PGconn *pg_link, const c
/* schame.table should be "schame"."table" */
table_copy = estrdup(table);
token = php_strtok_r(table_copy, ".", &tmp);
+ if (token == NULL) {
+ token = table;
+ }
... | null | null | null |
4,137 | static void _free_ptr(zend_resource *rsrc)
{
pgLofp *lofp = (pgLofp *)rsrc->ptr;
efree(lofp);
}
| DoS | 0 | static void _free_ptr(zend_resource *rsrc)
{
pgLofp *lofp = (pgLofp *)rsrc->ptr;
efree(lofp);
}
| @@ -6445,6 +6445,9 @@ static inline void build_tablename(smart_str *querystr, PGconn *pg_link, const c
/* schame.table should be "schame"."table" */
table_copy = estrdup(table);
token = php_strtok_r(table_copy, ".", &tmp);
+ if (token == NULL) {
+ token = table;
+ }
... | null | null | null |
4,138 | static int _php_pgsql_detect_identifier_escape(const char *identifier, size_t len) /* {{{ */
{
size_t i;
/* Handle edge case. Cannot be a escaped string */
if (len <= 2) {
return FAILURE;
}
/* Detect double qoutes */
if (identifier[0] == '"' && identifier[len-1] == '"') {
/* Detect wrong format of " inside o... | DoS | 0 | static int _php_pgsql_detect_identifier_escape(const char *identifier, size_t len) /* {{{ */
{
size_t i;
/* Handle edge case. Cannot be a escaped string */
if (len <= 2) {
return FAILURE;
}
/* Detect double qoutes */
if (identifier[0] == '"' && identifier[len-1] == '"') {
/* Detect wrong format of " inside o... | @@ -6445,6 +6445,9 @@ static inline void build_tablename(smart_str *querystr, PGconn *pg_link, const c
/* schame.table should be "schame"."table" */
table_copy = estrdup(table);
token = php_strtok_r(table_copy, ".", &tmp);
+ if (token == NULL) {
+ token = table;
+ }
... | null | null | null |
4,139 | static void _php_pgsql_free_params(char **params, int num_params)
{
if (num_params > 0) {
int i;
for (i = 0; i < num_params; i++) {
if (params[i]) {
efree(params[i]);
}
}
efree(params);
}
}
| DoS | 0 | static void _php_pgsql_free_params(char **params, int num_params)
{
if (num_params > 0) {
int i;
for (i = 0; i < num_params; i++) {
if (params[i]) {
efree(params[i]);
}
}
efree(params);
}
}
| @@ -6445,6 +6445,9 @@ static inline void build_tablename(smart_str *querystr, PGconn *pg_link, const c
/* schame.table should be "schame"."table" */
table_copy = estrdup(table);
token = php_strtok_r(table_copy, ".", &tmp);
+ if (token == NULL) {
+ token = table;
+ }
... | null | null | null |
4,140 | static int _php_pgsql_link_has_results(PGconn *pgsql) /* {{{ */
{
PGresult *result;
while ((result = PQgetResult(pgsql))) {
PQclear(result);
return 1;
}
return 0;
}
/* }}} */
| DoS | 0 | static int _php_pgsql_link_has_results(PGconn *pgsql) /* {{{ */
{
PGresult *result;
while ((result = PQgetResult(pgsql))) {
PQclear(result);
return 1;
}
return 0;
}
/* }}} */
| @@ -6445,6 +6445,9 @@ static inline void build_tablename(smart_str *querystr, PGconn *pg_link, const c
/* schame.table should be "schame"."table" */
table_copy = estrdup(table);
token = php_strtok_r(table_copy, ".", &tmp);
+ if (token == NULL) {
+ token = table;
+ }
... | null | null | null |
4,141 | static void _php_pgsql_notice_handler(void *resource_id, const char *message)
{
php_pgsql_notice *notice;
if (! PGG(ignore_notices)) {
notice = (php_pgsql_notice *)emalloc(sizeof(php_pgsql_notice));
notice->message = _php_pgsql_trim_message(message, ¬ice->len);
if (PGG(log_notices)) {
php_error_docref(N... | DoS | 0 | static void _php_pgsql_notice_handler(void *resource_id, const char *message)
{
php_pgsql_notice *notice;
if (! PGG(ignore_notices)) {
notice = (php_pgsql_notice *)emalloc(sizeof(php_pgsql_notice));
notice->message = _php_pgsql_trim_message(message, ¬ice->len);
if (PGG(log_notices)) {
php_error_docref(N... | @@ -6445,6 +6445,9 @@ static inline void build_tablename(smart_str *querystr, PGconn *pg_link, const c
/* schame.table should be "schame"."table" */
table_copy = estrdup(table);
token = php_strtok_r(table_copy, ".", &tmp);
+ if (token == NULL) {
+ token = table;
+ }
... | null | null | null |
4,142 | static void _php_pgsql_notice_ptr_dtor(zval *el)
{
php_pgsql_notice *notice = (php_pgsql_notice *)Z_PTR_P(el);
if (notice) {
efree(notice->message);
efree(notice);
}
}
| DoS | 0 | static void _php_pgsql_notice_ptr_dtor(zval *el)
{
php_pgsql_notice *notice = (php_pgsql_notice *)Z_PTR_P(el);
if (notice) {
efree(notice->message);
efree(notice);
}
}
| @@ -6445,6 +6445,9 @@ static inline void build_tablename(smart_str *querystr, PGconn *pg_link, const c
/* schame.table should be "schame"."table" */
table_copy = estrdup(table);
token = php_strtok_r(table_copy, ".", &tmp);
+ if (token == NULL) {
+ token = table;
+ }
... | null | null | null |
4,143 | static char * _php_pgsql_trim_message(const char *message, size_t *len)
{
register size_t i = strlen(message)-1;
if (i>1 && (message[i-1] == '\r' || message[i-1] == '\n') && message[i] == '.') {
--i;
}
while (i>0 && (message[i] == '\r' || message[i] == '\n')) {
--i;
}
++i;
if (len) {
*len = i;
}
return ... | DoS | 0 | static char * _php_pgsql_trim_message(const char *message, size_t *len)
{
register size_t i = strlen(message)-1;
if (i>1 && (message[i-1] == '\r' || message[i-1] == '\n') && message[i] == '.') {
--i;
}
while (i>0 && (message[i] == '\r' || message[i] == '\n')) {
--i;
}
++i;
if (len) {
*len = i;
}
return ... | @@ -6445,6 +6445,9 @@ static inline void build_tablename(smart_str *querystr, PGconn *pg_link, const c
/* schame.table should be "schame"."table" */
table_copy = estrdup(table);
token = php_strtok_r(table_copy, ".", &tmp);
+ if (token == NULL) {
+ token = table;
+ }
... | null | null | null |
4,144 | static inline char * _php_pgsql_trim_result(PGconn * pgsql, char **buf)
{
return *buf = _php_pgsql_trim_message(PQerrorMessage(pgsql), NULL);
}
| DoS | 0 | static inline char * _php_pgsql_trim_result(PGconn * pgsql, char **buf)
{
return *buf = _php_pgsql_trim_message(PQerrorMessage(pgsql), NULL);
}
| @@ -6445,6 +6445,9 @@ static inline void build_tablename(smart_str *querystr, PGconn *pg_link, const c
/* schame.table should be "schame"."table" */
table_copy = estrdup(table);
token = php_strtok_r(table_copy, ".", &tmp);
+ if (token == NULL) {
+ token = table;
+ }
... | null | null | null |
4,145 | static int _rollback_transactions(zval *el)
{
PGconn *link;
PGresult *res;
int orig;
zend_resource *rsrc = Z_RES_P(el);
if (rsrc->type != le_plink)
return 0;
link = (PGconn *) rsrc->ptr;
if (PQ_SETNONBLOCKING(link, 0)) {
php_error_docref("ref.pgsql", E_NOTICE, "Cannot set connection to blocking mode");
... | DoS | 0 | static int _rollback_transactions(zval *el)
{
PGconn *link;
PGresult *res;
int orig;
zend_resource *rsrc = Z_RES_P(el);
if (rsrc->type != le_plink)
return 0;
link = (PGconn *) rsrc->ptr;
if (PQ_SETNONBLOCKING(link, 0)) {
php_error_docref("ref.pgsql", E_NOTICE, "Cannot set connection to blocking mode");
... | @@ -6445,6 +6445,9 @@ static inline void build_tablename(smart_str *querystr, PGconn *pg_link, const c
/* schame.table should be "schame"."table" */
table_copy = estrdup(table);
token = php_strtok_r(table_copy, ".", &tmp);
+ if (token == NULL) {
+ token = table;
+ }
... | null | null | null |
4,146 | static int do_exec(smart_str *querystr, int expect, PGconn *pg_link, zend_ulong opt) /* {{{ */
{
if (opt & PGSQL_DML_ASYNC) {
if (PQsendQuery(pg_link, querystr->s->val)) {
return 0;
}
}
else {
PGresult *pg_result;
pg_result = PQexec(pg_link, querystr->s->val);
if (PQresultStatus(pg_result) == expect) {... | DoS | 0 | static int do_exec(smart_str *querystr, int expect, PGconn *pg_link, zend_ulong opt) /* {{{ */
{
if (opt & PGSQL_DML_ASYNC) {
if (PQsendQuery(pg_link, querystr->s->val)) {
return 0;
}
}
else {
PGresult *pg_result;
pg_result = PQexec(pg_link, querystr->s->val);
if (PQresultStatus(pg_result) == expect) {... | @@ -6445,6 +6445,9 @@ static inline void build_tablename(smart_str *querystr, PGconn *pg_link, const c
/* schame.table should be "schame"."table" */
table_copy = estrdup(table);
token = php_strtok_r(table_copy, ".", &tmp);
+ if (token == NULL) {
+ token = table;
+ }
... | null | null | null |
4,147 | static char *get_field_name(PGconn *pgsql, Oid oid, HashTable *list)
{
PGresult *result;
smart_str str = {0};
zend_resource *field_type;
char *ret=NULL;
/* try to lookup the type in the resource list */
smart_str_appends(&str, "pgsql_oid_");
smart_str_append_unsigned(&str, oid);
smart_str_0(&str);
if ((field... | DoS | 0 | static char *get_field_name(PGconn *pgsql, Oid oid, HashTable *list)
{
PGresult *result;
smart_str str = {0};
zend_resource *field_type;
char *ret=NULL;
/* try to lookup the type in the resource list */
smart_str_appends(&str, "pgsql_oid_");
smart_str_append_unsigned(&str, oid);
smart_str_0(&str);
if ((field... | @@ -6445,6 +6445,9 @@ static inline void build_tablename(smart_str *querystr, PGconn *pg_link, const c
/* schame.table should be "schame"."table" */
table_copy = estrdup(table);
token = php_strtok_r(table_copy, ".", &tmp);
+ if (token == NULL) {
+ token = table;
+ }
... | null | null | null |
4,148 | static int php_pgsql_add_quotes(zval *src, zend_bool should_free)
{
smart_str str = {0};
assert(Z_TYPE_P(src) == IS_STRING);
assert(should_free == 1 || should_free == 0);
smart_str_appendc(&str, 'E');
smart_str_appendc(&str, '\'');
smart_str_appendl(&str, Z_STRVAL_P(src), Z_STRLEN_P(src));
smart_str_appendc(&... | DoS | 0 | static int php_pgsql_add_quotes(zval *src, zend_bool should_free)
{
smart_str str = {0};
assert(Z_TYPE_P(src) == IS_STRING);
assert(should_free == 1 || should_free == 0);
smart_str_appendc(&str, 'E');
smart_str_appendc(&str, '\'');
smart_str_appendl(&str, Z_STRVAL_P(src), Z_STRLEN_P(src));
smart_str_appendc(&... | @@ -6445,6 +6445,9 @@ static inline void build_tablename(smart_str *querystr, PGconn *pg_link, const c
/* schame.table should be "schame"."table" */
table_copy = estrdup(table);
token = php_strtok_r(table_copy, ".", &tmp);
+ if (token == NULL) {
+ token = table;
+ }
... | null | null | null |
4,149 | PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, const zval *values, zval *result, zend_ulong opt)
{
zend_string *field = NULL;
zend_ulong num_idx = -1;
zval meta, *def, *type, *not_null, *has_default, *is_enum, *val, new_val;
int err = 0, skip_field;
php_pgsql_data_type data_type;
a... | DoS | 0 | PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, const zval *values, zval *result, zend_ulong opt)
{
zend_string *field = NULL;
zend_ulong num_idx = -1;
zval meta, *def, *type, *not_null, *has_default, *is_enum, *val, new_val;
int err = 0, skip_field;
php_pgsql_data_type data_type;
a... | @@ -6445,6 +6445,9 @@ static inline void build_tablename(smart_str *querystr, PGconn *pg_link, const c
/* schame.table should be "schame"."table" */
table_copy = estrdup(table);
token = php_strtok_r(table_copy, ".", &tmp);
+ if (token == NULL) {
+ token = table;
+ }
... | null | null | null |
4,150 | static int php_pgsql_convert_match(const char *str, size_t str_len, const char *regex , int icase)
{
regex_t re;
regmatch_t *subs;
int regopt = REG_EXTENDED;
int regerr, ret = SUCCESS;
size_t i;
/* Check invalid chars for POSIX regex */
for (i = 0; i < str_len; i++) {
if (str[i] == '\n' ||
str[i] == '\r' |... | DoS | 0 | static int php_pgsql_convert_match(const char *str, size_t str_len, const char *regex , int icase)
{
regex_t re;
regmatch_t *subs;
int regopt = REG_EXTENDED;
int regerr, ret = SUCCESS;
size_t i;
/* Check invalid chars for POSIX regex */
for (i = 0; i < str_len; i++) {
if (str[i] == '\n' ||
str[i] == '\r' |... | @@ -6445,6 +6445,9 @@ static inline void build_tablename(smart_str *querystr, PGconn *pg_link, const c
/* schame.table should be "schame"."table" */
table_copy = estrdup(table);
token = php_strtok_r(table_copy, ".", &tmp);
+ if (token == NULL) {
+ token = table;
+ }
... | null | null | null |
4,151 | static void php_pgsql_data_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type)
{
zval *result, *field;
zend_long row;
PGresult *pgsql_result;
pgsql_result_handle *pg_result;
int field_offset, pgsql_row, argc = ZEND_NUM_ARGS();
if (argc == 2) {
if (zend_parse_parameters(argc, "rz", &result, &field) == FAILURE) {... | DoS | 0 | static void php_pgsql_data_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type)
{
zval *result, *field;
zend_long row;
PGresult *pgsql_result;
pgsql_result_handle *pg_result;
int field_offset, pgsql_row, argc = ZEND_NUM_ARGS();
if (argc == 2) {
if (zend_parse_parameters(argc, "rz", &result, &field) == FAILURE) {... | @@ -6445,6 +6445,9 @@ static inline void build_tablename(smart_str *querystr, PGconn *pg_link, const c
/* schame.table should be "schame"."table" */
table_copy = estrdup(table);
token = php_strtok_r(table_copy, ".", &tmp);
+ if (token == NULL) {
+ token = table;
+ }
... | null | null | null |
4,152 | PHP_PGSQL_API int php_pgsql_delete(PGconn *pg_link, const char *table, zval *ids_array, zend_ulong opt, zend_string **sql)
{
zval ids_converted;
smart_str querystr = {0};
int ret = FAILURE;
assert(pg_link != NULL);
assert(table != NULL);
assert(Z_TYPE_P(ids_array) == IS_ARRAY);
assert(!(opt & ~(PGSQL_CONV_FORC... | DoS | 0 | PHP_PGSQL_API int php_pgsql_delete(PGconn *pg_link, const char *table, zval *ids_array, zend_ulong opt, zend_string **sql)
{
zval ids_converted;
smart_str querystr = {0};
int ret = FAILURE;
assert(pg_link != NULL);
assert(table != NULL);
assert(Z_TYPE_P(ids_array) == IS_ARRAY);
assert(!(opt & ~(PGSQL_CONV_FORC... | @@ -6445,6 +6445,9 @@ static inline void build_tablename(smart_str *querystr, PGconn *pg_link, const c
/* schame.table should be "schame"."table" */
table_copy = estrdup(table);
token = php_strtok_r(table_copy, ".", &tmp);
+ if (token == NULL) {
+ token = table;
+ }
... | null | null | null |
4,153 | static void php_pgsql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
{
char *host=NULL,*port=NULL,*options=NULL,*tty=NULL,*dbname=NULL,*connstring=NULL;
PGconn *pgsql;
smart_str str = {0};
zval *args;
uint32_t i;
int connect_type = 0;
PGresult *pg_result;
args = (zval *)safe_emalloc(ZEND_NUM_ARGS(), ... | DoS | 0 | static void php_pgsql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
{
char *host=NULL,*port=NULL,*options=NULL,*tty=NULL,*dbname=NULL,*connstring=NULL;
PGconn *pgsql;
smart_str str = {0};
zval *args;
uint32_t i;
int connect_type = 0;
PGresult *pg_result;
args = (zval *)safe_emalloc(ZEND_NUM_ARGS(), ... | @@ -6445,6 +6445,9 @@ static inline void build_tablename(smart_str *querystr, PGconn *pg_link, const c
/* schame.table should be "schame"."table" */
table_copy = estrdup(table);
token = php_strtok_r(table_copy, ".", &tmp);
+ if (token == NULL) {
+ token = table;
+ }
... | null | null | null |
4,154 | static void php_pgsql_escape_internal(INTERNAL_FUNCTION_PARAMETERS, int escape_literal) /* {{{ */ {
char *from = NULL;
zval *pgsql_link = NULL;
PGconn *pgsql;
size_t from_len;
int id = -1;
char *tmp;
switch (ZEND_NUM_ARGS()) {
case 1:
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &from, &from_len) == FAI... | DoS | 0 | static void php_pgsql_escape_internal(INTERNAL_FUNCTION_PARAMETERS, int escape_literal) /* {{{ */ {
char *from = NULL;
zval *pgsql_link = NULL;
PGconn *pgsql;
size_t from_len;
int id = -1;
char *tmp;
switch (ZEND_NUM_ARGS()) {
case 1:
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &from, &from_len) == FAI... | @@ -6445,6 +6445,9 @@ static inline void build_tablename(smart_str *querystr, PGconn *pg_link, const c
/* schame.table should be "schame"."table" */
table_copy = estrdup(table);
token = php_strtok_r(table_copy, ".", &tmp);
+ if (token == NULL) {
+ token = table;
+ }
... | null | null | null |
4,155 | static int php_pgsql_fd_cast(php_stream *stream, int cast_as, void **ret) /* {{{ */
{
PGconn *pgsql = (PGconn *) stream->abstract;
int fd_number;
switch (cast_as) {
case PHP_STREAM_AS_FD_FOR_SELECT:
case PHP_STREAM_AS_FD:
case PHP_STREAM_AS_SOCKETD:
if (ret) {
fd_number = PQsocket(pgsql);
if (fd_nu... | DoS | 0 | static int php_pgsql_fd_cast(php_stream *stream, int cast_as, void **ret) /* {{{ */
{
PGconn *pgsql = (PGconn *) stream->abstract;
int fd_number;
switch (cast_as) {
case PHP_STREAM_AS_FD_FOR_SELECT:
case PHP_STREAM_AS_FD:
case PHP_STREAM_AS_SOCKETD:
if (ret) {
fd_number = PQsocket(pgsql);
if (fd_nu... | @@ -6445,6 +6445,9 @@ static inline void build_tablename(smart_str *querystr, PGconn *pg_link, const c
/* schame.table should be "schame"."table" */
table_copy = estrdup(table);
token = php_strtok_r(table_copy, ".", &tmp);
+ if (token == NULL) {
+ token = table;
+ }
... | null | null | null |
4,156 | static int php_pgsql_fd_close(php_stream *stream, int close_handle) /* {{{ */
{
return EOF;
}
/* }}} */
| DoS | 0 | static int php_pgsql_fd_close(php_stream *stream, int close_handle) /* {{{ */
{
return EOF;
}
/* }}} */
| @@ -6445,6 +6445,9 @@ static inline void build_tablename(smart_str *querystr, PGconn *pg_link, const c
/* schame.table should be "schame"."table" */
table_copy = estrdup(table);
token = php_strtok_r(table_copy, ".", &tmp);
+ if (token == NULL) {
+ token = table;
+ }
... | null | null | null |
4,157 | static int php_pgsql_fd_flush(php_stream *stream) /* {{{ */
{
return FAILURE;
}
/* }}} */
| DoS | 0 | static int php_pgsql_fd_flush(php_stream *stream) /* {{{ */
{
return FAILURE;
}
/* }}} */
| @@ -6445,6 +6445,9 @@ static inline void build_tablename(smart_str *querystr, PGconn *pg_link, const c
/* schame.table should be "schame"."table" */
table_copy = estrdup(table);
token = php_strtok_r(table_copy, ".", &tmp);
+ if (token == NULL) {
+ token = table;
+ }
... | null | null | null |
4,158 | static size_t php_pgsql_fd_read(php_stream *stream, char *buf, size_t count) /* {{{ */
{
return 0;
}
/* }}} */
| DoS | 0 | static size_t php_pgsql_fd_read(php_stream *stream, char *buf, size_t count) /* {{{ */
{
return 0;
}
/* }}} */
| @@ -6445,6 +6445,9 @@ static inline void build_tablename(smart_str *querystr, PGconn *pg_link, const c
/* schame.table should be "schame"."table" */
table_copy = estrdup(table);
token = php_strtok_r(table_copy, ".", &tmp);
+ if (token == NULL) {
+ token = table;
+ }
... | null | null | null |
4,159 | static int php_pgsql_fd_set_option(php_stream *stream, int option, int value, void *ptrparam) /* {{{ */
{
PGconn *pgsql = (PGconn *) stream->abstract;
switch (option) {
case PHP_STREAM_OPTION_BLOCKING:
return PQ_SETNONBLOCKING(pgsql, value);
default:
return FAILURE;
}
}
/* }}} */
| DoS | 0 | static int php_pgsql_fd_set_option(php_stream *stream, int option, int value, void *ptrparam) /* {{{ */
{
PGconn *pgsql = (PGconn *) stream->abstract;
switch (option) {
case PHP_STREAM_OPTION_BLOCKING:
return PQ_SETNONBLOCKING(pgsql, value);
default:
return FAILURE;
}
}
/* }}} */
| @@ -6445,6 +6445,9 @@ static inline void build_tablename(smart_str *querystr, PGconn *pg_link, const c
/* schame.table should be "schame"."table" */
table_copy = estrdup(table);
token = php_strtok_r(table_copy, ".", &tmp);
+ if (token == NULL) {
+ token = table;
+ }
... | null | null | null |
4,160 | static php_pgsql_data_type php_pgsql_get_data_type(const char *type_name, size_t len)
{
/* This is stupid way to do. I'll fix it when I decied how to support
user defined types. (Yasuo) */
/* boolean */
if (!strcmp(type_name, "bool")|| !strcmp(type_name, "boolean"))
return PG_BOOL;
/* object id */
if (!strc... | DoS | 0 | static php_pgsql_data_type php_pgsql_get_data_type(const char *type_name, size_t len)
{
/* This is stupid way to do. I'll fix it when I decied how to support
user defined types. (Yasuo) */
/* boolean */
if (!strcmp(type_name, "bool")|| !strcmp(type_name, "boolean"))
return PG_BOOL;
/* object id */
if (!strc... | @@ -6445,6 +6445,9 @@ static inline void build_tablename(smart_str *querystr, PGconn *pg_link, const c
/* schame.table should be "schame"."table" */
table_copy = estrdup(table);
token = php_strtok_r(table_copy, ".", &tmp);
+ if (token == NULL) {
+ token = table;
+ }
... | null | null | null |
4,161 | static void php_pgsql_get_field_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type)
{
zval *result;
zend_long field;
PGresult *pgsql_result;
pgsql_result_handle *pg_result;
Oid oid;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl", &result, &field) == FAILURE) {
return;
}
ZEND_FETCH_RESOURCE(pg_result, pgsql_... | DoS | 0 | static void php_pgsql_get_field_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type)
{
zval *result;
zend_long field;
PGresult *pgsql_result;
pgsql_result_handle *pg_result;
Oid oid;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl", &result, &field) == FAILURE) {
return;
}
ZEND_FETCH_RESOURCE(pg_result, pgsql_... | @@ -6445,6 +6445,9 @@ static inline void build_tablename(smart_str *querystr, PGconn *pg_link, const c
/* schame.table should be "schame"."table" */
table_copy = estrdup(table);
token = php_strtok_r(table_copy, ".", &tmp);
+ if (token == NULL) {
+ token = table;
+ }
... | null | null | null |
4,162 | static void php_pgsql_get_link_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type)
{
zval *pgsql_link = NULL;
int id = -1, argc = ZEND_NUM_ARGS();
PGconn *pgsql;
char *msgbuf;
char *result;
if (zend_parse_parameters(argc, "|r", &pgsql_link) == FAILURE) {
return;
}
if (argc == 0) {
id = FETCH_DEFAULT_LINK(... | DoS | 0 | static void php_pgsql_get_link_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type)
{
zval *pgsql_link = NULL;
int id = -1, argc = ZEND_NUM_ARGS();
PGconn *pgsql;
char *msgbuf;
char *result;
if (zend_parse_parameters(argc, "|r", &pgsql_link) == FAILURE) {
return;
}
if (argc == 0) {
id = FETCH_DEFAULT_LINK(... | @@ -6445,6 +6445,9 @@ static inline void build_tablename(smart_str *querystr, PGconn *pg_link, const c
/* schame.table should be "schame"."table" */
table_copy = estrdup(table);
token = php_strtok_r(table_copy, ".", &tmp);
+ if (token == NULL) {
+ token = table;
+ }
... | null | null | null |
4,163 | static void php_pgsql_get_result_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type)
{
zval *result;
PGresult *pgsql_result;
pgsql_result_handle *pg_result;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &result) == FAILURE) {
return;
}
ZEND_FETCH_RESOURCE(pg_result, pgsql_result_handle *, result, -1, "Postg... | DoS | 0 | static void php_pgsql_get_result_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type)
{
zval *result;
PGresult *pgsql_result;
pgsql_result_handle *pg_result;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &result) == FAILURE) {
return;
}
ZEND_FETCH_RESOURCE(pg_result, pgsql_result_handle *, result, -1, "Postg... | @@ -6445,6 +6445,9 @@ static inline void build_tablename(smart_str *querystr, PGconn *pg_link, const c
/* schame.table should be "schame"."table" */
table_copy = estrdup(table);
token = php_strtok_r(table_copy, ".", &tmp);
+ if (token == NULL) {
+ token = table;
+ }
... | null | null | null |
4,164 | PHP_PGSQL_API int php_pgsql_insert(PGconn *pg_link, const char *table, zval *var_array, zend_ulong opt, zend_string **sql)
{
zval *val, converted;
char buf[256];
char *tmp;
smart_str querystr = {0};
int ret = FAILURE;
zend_ulong num_idx;
zend_string *fld;
assert(pg_link != NULL);
assert(table != NULL);
asser... | DoS | 0 | PHP_PGSQL_API int php_pgsql_insert(PGconn *pg_link, const char *table, zval *var_array, zend_ulong opt, zend_string **sql)
{
zval *val, converted;
char buf[256];
char *tmp;
smart_str querystr = {0};
int ret = FAILURE;
zend_ulong num_idx;
zend_string *fld;
assert(pg_link != NULL);
assert(table != NULL);
asser... | @@ -6445,6 +6445,9 @@ static inline void build_tablename(smart_str *querystr, PGconn *pg_link, const c
/* schame.table should be "schame"."table" */
table_copy = estrdup(table);
token = php_strtok_r(table_copy, ".", &tmp);
+ if (token == NULL) {
+ token = table;
+ }
... | null | null | null |
4,165 | PHP_PGSQL_API int php_pgsql_result2array(PGresult *pg_result, zval *ret_array)
{
zval row;
char *field_name;
size_t num_fields;
int pg_numrows, pg_row;
uint i;
assert(Z_TYPE_P(ret_array) == IS_ARRAY);
if ((pg_numrows = PQntuples(pg_result)) <= 0) {
return FAILURE;
}
for (pg_row = 0; pg_row < pg_numrows; pg... | DoS | 0 | PHP_PGSQL_API int php_pgsql_result2array(PGresult *pg_result, zval *ret_array)
{
zval row;
char *field_name;
size_t num_fields;
int pg_numrows, pg_row;
uint i;
assert(Z_TYPE_P(ret_array) == IS_ARRAY);
if ((pg_numrows = PQntuples(pg_result)) <= 0) {
return FAILURE;
}
for (pg_row = 0; pg_row < pg_numrows; pg... | @@ -6445,6 +6445,9 @@ static inline void build_tablename(smart_str *querystr, PGconn *pg_link, const c
/* schame.table should be "schame"."table" */
table_copy = estrdup(table);
token = php_strtok_r(table_copy, ".", &tmp);
+ if (token == NULL) {
+ token = table;
+ }
... | null | null | null |
4,166 | PHP_PGSQL_API int php_pgsql_select(PGconn *pg_link, const char *table, zval *ids_array, zval *ret_array, zend_ulong opt, zend_string **sql)
{
zval ids_converted;
smart_str querystr = {0};
int ret = FAILURE;
PGresult *pg_result;
assert(pg_link != NULL);
assert(table != NULL);
assert(Z_TYPE_P(ids_array) == IS_ARR... | DoS | 0 | PHP_PGSQL_API int php_pgsql_select(PGconn *pg_link, const char *table, zval *ids_array, zval *ret_array, zend_ulong opt, zend_string **sql)
{
zval ids_converted;
smart_str querystr = {0};
int ret = FAILURE;
PGresult *pg_result;
assert(pg_link != NULL);
assert(table != NULL);
assert(Z_TYPE_P(ids_array) == IS_ARR... | @@ -6445,6 +6445,9 @@ static inline void build_tablename(smart_str *querystr, PGconn *pg_link, const c
/* schame.table should be "schame"."table" */
table_copy = estrdup(table);
token = php_strtok_r(table_copy, ".", &tmp);
+ if (token == NULL) {
+ token = table;
+ }
... | null | null | null |
4,167 | static unsigned char * php_pgsql_unescape_bytea(unsigned char *strtext, size_t *retbuflen) /* {{{ */
{
size_t buflen;
unsigned char *buffer,
*sp,
*bp;
unsigned int state = 0;
if (strtext == NULL)
return NULL;
buflen = strlen(strtext); /* will shrink, also we discover if
* strtext */
bu... | DoS | 0 | static unsigned char * php_pgsql_unescape_bytea(unsigned char *strtext, size_t *retbuflen) /* {{{ */
{
size_t buflen;
unsigned char *buffer,
*sp,
*bp;
unsigned int state = 0;
if (strtext == NULL)
return NULL;
buflen = strlen(strtext); /* will shrink, also we discover if
* strtext */
bu... | @@ -6445,6 +6445,9 @@ static inline void build_tablename(smart_str *querystr, PGconn *pg_link, const c
/* schame.table should be "schame"."table" */
table_copy = estrdup(table);
token = php_strtok_r(table_copy, ".", &tmp);
+ if (token == NULL) {
+ token = table;
+ }
... | null | null | null |
4,168 | static void copy_shared_segments(void *to, void *from, int count, int size)
{
zend_shared_segment **shared_segments_v = (zend_shared_segment **)to;
void *shared_segments_to_p = ((char *)to + count*(sizeof(void *)));
void *shared_segments_from_p = from;
int i;
for (i = 0; i < count; i++) {
shared_segments_v[i] =... | DoS | 0 | static void copy_shared_segments(void *to, void *from, int count, int size)
{
zend_shared_segment **shared_segments_v = (zend_shared_segment **)to;
void *shared_segments_to_p = ((char *)to + count*(sizeof(void *)));
void *shared_segments_from_p = from;
int i;
for (i = 0; i < count; i++) {
shared_segments_v[i] =... | @@ -344,10 +344,10 @@ void *_zend_shared_memdup(void *source, size_t size, zend_bool free_source)
retval = ZCG(mem);
ZCG(mem) = (void*)(((char*)ZCG(mem)) + ZEND_ALIGNED_SIZE(size));
memcpy(retval, source, size);
+ zend_shared_alloc_register_xlat_entry(source, retval);
if (free_sour... | CWE-416 | null | null |
4,169 | static void no_memory_bailout(size_t allocate_size, char *error)
{
zend_accel_error(ACCEL_LOG_FATAL, "Unable to allocate shared memory segment of %ld bytes: %s: %s (%d)", allocate_size, error?error:"unknown", strerror(errno), errno );
}
| DoS | 0 | static void no_memory_bailout(size_t allocate_size, char *error)
{
zend_accel_error(ACCEL_LOG_FATAL, "Unable to allocate shared memory segment of %ld bytes: %s: %s (%d)", allocate_size, error?error:"unknown", strerror(errno), errno );
}
| @@ -344,10 +344,10 @@ void *_zend_shared_memdup(void *source, size_t size, zend_bool free_source)
retval = ZCG(mem);
ZCG(mem) = (void*)(((char*)ZCG(mem)) + ZEND_ALIGNED_SIZE(size));
memcpy(retval, source, size);
+ zend_shared_alloc_register_xlat_entry(source, retval);
if (free_sour... | CWE-416 | null | null |
4,170 | const char *zend_accel_get_shared_model(void)
{
return g_shared_model;
}
| DoS | 0 | const char *zend_accel_get_shared_model(void)
{
return g_shared_model;
}
| @@ -344,10 +344,10 @@ void *_zend_shared_memdup(void *source, size_t size, zend_bool free_source)
retval = ZCG(mem);
ZCG(mem) = (void*)(((char*)ZCG(mem)) + ZEND_ALIGNED_SIZE(size));
memcpy(retval, source, size);
+ zend_shared_alloc_register_xlat_entry(source, retval);
if (free_sour... | CWE-416 | null | null |
4,171 | void zend_accel_shared_protect(int mode)
{
#ifdef HAVE_MPROTECT
int i;
if (mode) {
mode = PROT_READ;
} else {
mode = PROT_READ|PROT_WRITE;
}
for (i = 0; i < ZSMMG(shared_segments_count); i++) {
mprotect(ZSMMG(shared_segments)[i]->p, ZSMMG(shared_segments)[i]->size, mode);
}
#endif
}
| DoS | 0 | void zend_accel_shared_protect(int mode)
{
#ifdef HAVE_MPROTECT
int i;
if (mode) {
mode = PROT_READ;
} else {
mode = PROT_READ|PROT_WRITE;
}
for (i = 0; i < ZSMMG(shared_segments_count); i++) {
mprotect(ZSMMG(shared_segments)[i]->p, ZSMMG(shared_segments)[i]->size, mode);
}
#endif
}
| @@ -344,10 +344,10 @@ void *_zend_shared_memdup(void *source, size_t size, zend_bool free_source)
retval = ZCG(mem);
ZCG(mem) = (void*)(((char*)ZCG(mem)) + ZEND_ALIGNED_SIZE(size));
memcpy(retval, source, size);
+ zend_shared_alloc_register_xlat_entry(source, retval);
if (free_sour... | CWE-416 | null | null |
4,172 | void *zend_shared_alloc(size_t size)
{
int i;
unsigned int block_size = ZEND_ALIGNED_SIZE(size);
#if 1
if (!ZCG(locked)) {
zend_accel_error(ACCEL_LOG_ERROR, "Shared memory lock not obtained");
}
#endif
if (block_size > ZSMMG(shared_free)) { /* No hope to find a big-enough block */
SHARED_ALLOC_FAILED();
ret... | DoS | 0 | void *zend_shared_alloc(size_t size)
{
int i;
unsigned int block_size = ZEND_ALIGNED_SIZE(size);
#if 1
if (!ZCG(locked)) {
zend_accel_error(ACCEL_LOG_ERROR, "Shared memory lock not obtained");
}
#endif
if (block_size > ZSMMG(shared_free)) { /* No hope to find a big-enough block */
SHARED_ALLOC_FAILED();
ret... | @@ -344,10 +344,10 @@ void *_zend_shared_memdup(void *source, size_t size, zend_bool free_source)
retval = ZCG(mem);
ZCG(mem) = (void*)(((char*)ZCG(mem)) + ZEND_ALIGNED_SIZE(size));
memcpy(retval, source, size);
+ zend_shared_alloc_register_xlat_entry(source, retval);
if (free_sour... | CWE-416 | null | null |
4,173 | void zend_shared_alloc_clear_xlat_table(void)
{
zend_hash_clean(&xlat_table);
}
| DoS | 0 | void zend_shared_alloc_clear_xlat_table(void)
{
zend_hash_clean(&xlat_table);
}
| @@ -344,10 +344,10 @@ void *_zend_shared_memdup(void *source, size_t size, zend_bool free_source)
retval = ZCG(mem);
ZCG(mem) = (void*)(((char*)ZCG(mem)) + ZEND_ALIGNED_SIZE(size));
memcpy(retval, source, size);
+ zend_shared_alloc_register_xlat_entry(source, retval);
if (free_sour... | CWE-416 | null | null |
4,174 | void zend_shared_alloc_create_lock(void)
{
int val;
#ifdef ZTS
zts_lock = tsrm_mutex_alloc();
#endif
sprintf(lockfile_name, "%s/%sXXXXXX", TMP_DIR, SEM_FILENAME_PREFIX);
lock_file = mkstemp(lockfile_name);
fchmod(lock_file, 0666);
if (lock_file == -1) {
zend_accel_error(ACCEL_LOG_FATAL, "Unable to create ... | DoS | 0 | void zend_shared_alloc_create_lock(void)
{
int val;
#ifdef ZTS
zts_lock = tsrm_mutex_alloc();
#endif
sprintf(lockfile_name, "%s/%sXXXXXX", TMP_DIR, SEM_FILENAME_PREFIX);
lock_file = mkstemp(lockfile_name);
fchmod(lock_file, 0666);
if (lock_file == -1) {
zend_accel_error(ACCEL_LOG_FATAL, "Unable to create ... | @@ -344,10 +344,10 @@ void *_zend_shared_memdup(void *source, size_t size, zend_bool free_source)
retval = ZCG(mem);
ZCG(mem) = (void*)(((char*)ZCG(mem)) + ZEND_ALIGNED_SIZE(size));
memcpy(retval, source, size);
+ zend_shared_alloc_register_xlat_entry(source, retval);
if (free_sour... | CWE-416 | null | null |
4,175 | size_t zend_shared_alloc_get_free_memory(void)
{
return ZSMMG(shared_free);
}
| DoS | 0 | size_t zend_shared_alloc_get_free_memory(void)
{
return ZSMMG(shared_free);
}
| @@ -344,10 +344,10 @@ void *_zend_shared_memdup(void *source, size_t size, zend_bool free_source)
retval = ZCG(mem);
ZCG(mem) = (void*)(((char*)ZCG(mem)) + ZEND_ALIGNED_SIZE(size));
memcpy(retval, source, size);
+ zend_shared_alloc_register_xlat_entry(source, retval);
if (free_sour... | CWE-416 | null | null |
4,176 | static size_t zend_shared_alloc_get_largest_free_block(void)
{
int i;
size_t largest_block_size = 0;
for (i = 0; i < ZSMMG(shared_segments_count); i++) {
size_t block_size = ZSMMG(shared_segments)[i]->size - ZSMMG(shared_segments)[i]->pos;
if (block_size>largest_block_size) {
largest_block_size = block_size... | DoS | 0 | static size_t zend_shared_alloc_get_largest_free_block(void)
{
int i;
size_t largest_block_size = 0;
for (i = 0; i < ZSMMG(shared_segments_count); i++) {
size_t block_size = ZSMMG(shared_segments)[i]->size - ZSMMG(shared_segments)[i]->pos;
if (block_size>largest_block_size) {
largest_block_size = block_size... | @@ -344,10 +344,10 @@ void *_zend_shared_memdup(void *source, size_t size, zend_bool free_source)
retval = ZCG(mem);
ZCG(mem) = (void*)(((char*)ZCG(mem)) + ZEND_ALIGNED_SIZE(size));
memcpy(retval, source, size);
+ zend_shared_alloc_register_xlat_entry(source, retval);
if (free_sour... | CWE-416 | null | null |
4,177 | void *zend_shared_alloc_get_xlat_entry(const void *old)
{
void *retval;
if ((retval = zend_hash_index_find_ptr(&xlat_table, (zend_ulong)old)) == NULL) {
return NULL;
}
return retval;
}
| DoS | 0 | void *zend_shared_alloc_get_xlat_entry(const void *old)
{
void *retval;
if ((retval = zend_hash_index_find_ptr(&xlat_table, (zend_ulong)old)) == NULL) {
return NULL;
}
return retval;
}
| @@ -344,10 +344,10 @@ void *_zend_shared_memdup(void *source, size_t size, zend_bool free_source)
retval = ZCG(mem);
ZCG(mem) = (void*)(((char*)ZCG(mem)) + ZEND_ALIGNED_SIZE(size));
memcpy(retval, source, size);
+ zend_shared_alloc_register_xlat_entry(source, retval);
if (free_sour... | CWE-416 | null | null |
4,178 | void zend_shared_alloc_lock(void)
{
#ifndef ZEND_WIN32
#ifdef ZTS
tsrm_mutex_lock(zts_lock);
#endif
#if 0
/* this will happen once per process, and will un-globalize mem_write_lock */
if (mem_write_lock.l_pid == -1) {
mem_write_lock.l_pid = getpid();
}
#endif
while (1) {
if (fcntl(lock_file, F_SETLKW, &mem_... | DoS | 0 | void zend_shared_alloc_lock(void)
{
#ifndef ZEND_WIN32
#ifdef ZTS
tsrm_mutex_lock(zts_lock);
#endif
#if 0
/* this will happen once per process, and will un-globalize mem_write_lock */
if (mem_write_lock.l_pid == -1) {
mem_write_lock.l_pid = getpid();
}
#endif
while (1) {
if (fcntl(lock_file, F_SETLKW, &mem_... | @@ -344,10 +344,10 @@ void *_zend_shared_memdup(void *source, size_t size, zend_bool free_source)
retval = ZCG(mem);
ZCG(mem) = (void*)(((char*)ZCG(mem)) + ZEND_ALIGNED_SIZE(size));
memcpy(retval, source, size);
+ zend_shared_alloc_register_xlat_entry(source, retval);
if (free_sour... | CWE-416 | null | null |
4,179 | void zend_shared_alloc_register_xlat_entry(const void *old, const void *new)
{
zend_hash_index_update_ptr(&xlat_table, (zend_ulong)old, (void*)new);
}
| DoS | 0 | void zend_shared_alloc_register_xlat_entry(const void *old, const void *new)
{
zend_hash_index_update_ptr(&xlat_table, (zend_ulong)old, (void*)new);
}
| @@ -344,10 +344,10 @@ void *_zend_shared_memdup(void *source, size_t size, zend_bool free_source)
retval = ZCG(mem);
ZCG(mem) = (void*)(((char*)ZCG(mem)) + ZEND_ALIGNED_SIZE(size));
memcpy(retval, source, size);
+ zend_shared_alloc_register_xlat_entry(source, retval);
if (free_sour... | CWE-416 | null | null |
4,180 | void zend_shared_alloc_safe_unlock(void)
{
if (ZCG(locked)) {
zend_shared_alloc_unlock();
}
}
| DoS | 0 | void zend_shared_alloc_safe_unlock(void)
{
if (ZCG(locked)) {
zend_shared_alloc_unlock();
}
}
| @@ -344,10 +344,10 @@ void *_zend_shared_memdup(void *source, size_t size, zend_bool free_source)
retval = ZCG(mem);
ZCG(mem) = (void*)(((char*)ZCG(mem)) + ZEND_ALIGNED_SIZE(size));
memcpy(retval, source, size);
+ zend_shared_alloc_register_xlat_entry(source, retval);
if (free_sour... | CWE-416 | null | null |
4,181 | void zend_shared_alloc_save_state(void)
{
int i;
for (i = 0; i < ZSMMG(shared_segments_count); i++) {
ZSMMG(shared_memory_state).positions[i] = ZSMMG(shared_segments)[i]->pos;
}
ZSMMG(shared_memory_state).shared_free = ZSMMG(shared_free);
}
| DoS | 0 | void zend_shared_alloc_save_state(void)
{
int i;
for (i = 0; i < ZSMMG(shared_segments_count); i++) {
ZSMMG(shared_memory_state).positions[i] = ZSMMG(shared_segments)[i]->pos;
}
ZSMMG(shared_memory_state).shared_free = ZSMMG(shared_free);
}
| @@ -344,10 +344,10 @@ void *_zend_shared_memdup(void *source, size_t size, zend_bool free_source)
retval = ZCG(mem);
ZCG(mem) = (void*)(((char*)ZCG(mem)) + ZEND_ALIGNED_SIZE(size));
memcpy(retval, source, size);
+ zend_shared_alloc_register_xlat_entry(source, retval);
if (free_sour... | CWE-416 | null | null |
4,182 | void zend_shared_alloc_shutdown(void)
{
zend_shared_segment **tmp_shared_segments;
size_t shared_segments_array_size;
zend_smm_shared_globals tmp_shared_globals;
int i;
tmp_shared_globals = *smm_shared_globals;
smm_shared_globals = &tmp_shared_globals;
shared_segments_array_size = ZSMMG(shared_segments_count) *... | DoS | 0 | void zend_shared_alloc_shutdown(void)
{
zend_shared_segment **tmp_shared_segments;
size_t shared_segments_array_size;
zend_smm_shared_globals tmp_shared_globals;
int i;
tmp_shared_globals = *smm_shared_globals;
smm_shared_globals = &tmp_shared_globals;
shared_segments_array_size = ZSMMG(shared_segments_count) *... | @@ -344,10 +344,10 @@ void *_zend_shared_memdup(void *source, size_t size, zend_bool free_source)
retval = ZCG(mem);
ZCG(mem) = (void*)(((char*)ZCG(mem)) + ZEND_ALIGNED_SIZE(size));
memcpy(retval, source, size);
+ zend_shared_alloc_register_xlat_entry(source, retval);
if (free_sour... | CWE-416 | null | null |
4,183 | static int zend_shared_alloc_try(const zend_shared_memory_handler_entry *he, size_t requested_size, zend_shared_segment ***shared_segments_p, int *shared_segments_count, char **error_in)
{
int res;
g_shared_alloc_handler = he->handler;
g_shared_model = he->name;
ZSMMG(shared_segments) = NULL;
ZSMMG(shared_segments... | DoS | 0 | static int zend_shared_alloc_try(const zend_shared_memory_handler_entry *he, size_t requested_size, zend_shared_segment ***shared_segments_p, int *shared_segments_count, char **error_in)
{
int res;
g_shared_alloc_handler = he->handler;
g_shared_model = he->name;
ZSMMG(shared_segments) = NULL;
ZSMMG(shared_segments... | @@ -344,10 +344,10 @@ void *_zend_shared_memdup(void *source, size_t size, zend_bool free_source)
retval = ZCG(mem);
ZCG(mem) = (void*)(((char*)ZCG(mem)) + ZEND_ALIGNED_SIZE(size));
memcpy(retval, source, size);
+ zend_shared_alloc_register_xlat_entry(source, retval);
if (free_sour... | CWE-416 | null | null |
4,184 | void zend_shared_alloc_unlock(void)
{
/* Destroy translation table */
zend_hash_destroy(&xlat_table);
ZCG(locked) = 0;
#ifndef ZEND_WIN32
if (fcntl(lock_file, F_SETLK, &mem_write_unlock) == -1) {
zend_accel_error(ACCEL_LOG_ERROR, "Cannot remove lock - %s (%d)", strerror(errno), errno);
}
#ifdef ZTS
tsrm_mutex... | DoS | 0 | void zend_shared_alloc_unlock(void)
{
/* Destroy translation table */
zend_hash_destroy(&xlat_table);
ZCG(locked) = 0;
#ifndef ZEND_WIN32
if (fcntl(lock_file, F_SETLK, &mem_write_unlock) == -1) {
zend_accel_error(ACCEL_LOG_ERROR, "Cannot remove lock - %s (%d)", strerror(errno), errno);
}
#ifdef ZTS
tsrm_mutex... | @@ -344,10 +344,10 @@ void *_zend_shared_memdup(void *source, size_t size, zend_bool free_source)
retval = ZCG(mem);
ZCG(mem) = (void*)(((char*)ZCG(mem)) + ZEND_ALIGNED_SIZE(size));
memcpy(retval, source, size);
+ zend_shared_alloc_register_xlat_entry(source, retval);
if (free_sour... | CWE-416 | null | null |
4,185 | bm_delta2_search (char const **tpp, char const *ep, char const *sp, int len,
char const *trans, char gc1, char gc2,
unsigned char const *d1, kwset_t kwset)
{
char const *tp = *tpp;
int d = len, skip = 0;
while (true)
{
int i = 2;
if (tr (trans, tp[-2]) == gc2)
... | DoS Overflow | 0 | bm_delta2_search (char const **tpp, char const *ep, char const *sp, int len,
char const *trans, char gc1, char gc2,
unsigned char const *d1, kwset_t kwset)
{
char const *tp = *tpp;
int d = len, skip = 0;
while (true)
{
int i = 2;
if (tr (trans, tp[-2]) == gc2)
... | @@ -643,6 +643,8 @@ bmexec_trans (kwset_t kwset, char const *text, size_t size)
if (! tp)
return -1;
tp++;
+ if (ep <= tp)
+ break;
}
}
} | CWE-119 | null | null |
4,186 | cwexec (kwset_t kwset, char const *text, size_t len, struct kwsmatch *kwsmatch)
{
struct trie * const *next;
struct trie const *trie;
struct trie const *accept;
char const *beg, *lim, *mch, *lmch;
unsigned char c;
unsigned char const *delta;
int d;
char const *end, *qlim;
struct tree const *tree;
ch... | DoS Overflow | 0 | cwexec (kwset_t kwset, char const *text, size_t len, struct kwsmatch *kwsmatch)
{
struct trie * const *next;
struct trie const *trie;
struct trie const *accept;
char const *beg, *lim, *mch, *lmch;
unsigned char c;
unsigned char const *delta;
int d;
char const *end, *qlim;
struct tree const *tree;
ch... | @@ -643,6 +643,8 @@ bmexec_trans (kwset_t kwset, char const *text, size_t size)
if (! tp)
return -1;
tp++;
+ if (ep <= tp)
+ break;
}
}
} | CWE-119 | null | null |
4,187 | kwsalloc (char const *trans)
{
struct kwset *kwset = xmalloc (sizeof *kwset);
obstack_init (&kwset->obstack);
kwset->words = 0;
kwset->trie = obstack_alloc (&kwset->obstack, sizeof *kwset->trie);
kwset->trie->accepting = 0;
kwset->trie->links = NULL;
kwset->trie->parent = NULL;
kwset->trie->next = NULL... | DoS Overflow | 0 | kwsalloc (char const *trans)
{
struct kwset *kwset = xmalloc (sizeof *kwset);
obstack_init (&kwset->obstack);
kwset->words = 0;
kwset->trie = obstack_alloc (&kwset->obstack, sizeof *kwset->trie);
kwset->trie->accepting = 0;
kwset->trie->links = NULL;
kwset->trie->parent = NULL;
kwset->trie->next = NULL... | @@ -643,6 +643,8 @@ bmexec_trans (kwset_t kwset, char const *text, size_t size)
if (! tp)
return -1;
tp++;
+ if (ep <= tp)
+ break;
}
}
} | CWE-119 | null | null |
4,188 | kwsfree (kwset_t kwset)
{
obstack_free (&kwset->obstack, NULL);
free (kwset);
}
| DoS Overflow | 0 | kwsfree (kwset_t kwset)
{
obstack_free (&kwset->obstack, NULL);
free (kwset);
}
| @@ -643,6 +643,8 @@ bmexec_trans (kwset_t kwset, char const *text, size_t size)
if (! tp)
return -1;
tp++;
+ if (ep <= tp)
+ break;
}
}
} | CWE-119 | null | null |
4,189 | kwsincr (kwset_t kwset, char const *text, size_t len)
{
struct trie *trie = kwset->trie;
char const *trans = kwset->trans;
text += len;
/* Descend the trie (built of reversed keywords) character-by-character,
installing new nodes when necessary. */
while (len--)
{
unsigned char uc = *--text;
... | DoS Overflow | 0 | kwsincr (kwset_t kwset, char const *text, size_t len)
{
struct trie *trie = kwset->trie;
char const *trans = kwset->trans;
text += len;
/* Descend the trie (built of reversed keywords) character-by-character,
installing new nodes when necessary. */
while (len--)
{
unsigned char uc = *--text;
... | @@ -643,6 +643,8 @@ bmexec_trans (kwset_t kwset, char const *text, size_t size)
if (! tp)
return -1;
tp++;
+ if (ep <= tp)
+ break;
}
}
} | CWE-119 | null | null |
4,190 | kwsprep (kwset_t kwset)
{
char const *trans = kwset->trans;
int i;
unsigned char deltabuf[NCHAR];
unsigned char *delta = trans ? deltabuf : kwset->delta;
/* Initial values for the delta table; will be changed later. The
delta entry for a given character is the smallest depth of any
node at which a... | DoS Overflow | 0 | kwsprep (kwset_t kwset)
{
char const *trans = kwset->trans;
int i;
unsigned char deltabuf[NCHAR];
unsigned char *delta = trans ? deltabuf : kwset->delta;
/* Initial values for the delta table; will be changed later. The
delta entry for a given character is the smallest depth of any
node at which a... | @@ -643,6 +643,8 @@ bmexec_trans (kwset_t kwset, char const *text, size_t size)
if (! tp)
return -1;
tp++;
+ if (ep <= tp)
+ break;
}
}
} | CWE-119 | null | null |
4,191 | memchr_kwset (char const *s, size_t n, kwset_t kwset)
{
if (kwset->gc1help < 0)
return memchr (s, kwset->gc1, n);
int small_heuristic = 2;
int small = (- (uintptr_t) s % sizeof (long)
+ small_heuristic * sizeof (long));
size_t ntrans = kwset->gc1help < NCHAR && small < n ? small : n;
char c... | DoS Overflow | 0 | memchr_kwset (char const *s, size_t n, kwset_t kwset)
{
if (kwset->gc1help < 0)
return memchr (s, kwset->gc1, n);
int small_heuristic = 2;
int small = (- (uintptr_t) s % sizeof (long)
+ small_heuristic * sizeof (long));
size_t ntrans = kwset->gc1help < NCHAR && small < n ? small : n;
char c... | @@ -643,6 +643,8 @@ bmexec_trans (kwset_t kwset, char const *text, size_t size)
if (! tp)
return -1;
tp++;
+ if (ep <= tp)
+ break;
}
}
} | CWE-119 | null | null |
4,192 | tr (char const *trans, char c)
{
return trans ? trans[U(c)] : c;
}
| DoS Overflow | 0 | tr (char const *trans, char c)
{
return trans ? trans[U(c)] : c;
}
| @@ -643,6 +643,8 @@ bmexec_trans (kwset_t kwset, char const *text, size_t size)
if (! tp)
return -1;
tp++;
+ if (ep <= tp)
+ break;
}
}
} | CWE-119 | null | null |
4,193 | treedelta (struct tree const *tree,
unsigned int depth,
unsigned char delta[])
{
if (!tree)
return;
treedelta(tree->llink, depth, delta);
treedelta(tree->rlink, depth, delta);
if (depth < delta[tree->label])
delta[tree->label] = depth;
}
| DoS Overflow | 0 | treedelta (struct tree const *tree,
unsigned int depth,
unsigned char delta[])
{
if (!tree)
return;
treedelta(tree->llink, depth, delta);
treedelta(tree->rlink, depth, delta);
if (depth < delta[tree->label])
delta[tree->label] = depth;
}
| @@ -643,6 +643,8 @@ bmexec_trans (kwset_t kwset, char const *text, size_t size)
if (! tp)
return -1;
tp++;
+ if (ep <= tp)
+ break;
}
}
} | CWE-119 | null | null |
4,194 | treefails (struct tree const *tree, struct trie const *fail,
struct trie *recourse)
{
struct tree *link;
if (!tree)
return;
treefails(tree->llink, fail, recourse);
treefails(tree->rlink, fail, recourse);
/* Find, in the chain of fails going back to the root, the first
node that has a de... | DoS Overflow | 0 | treefails (struct tree const *tree, struct trie const *fail,
struct trie *recourse)
{
struct tree *link;
if (!tree)
return;
treefails(tree->llink, fail, recourse);
treefails(tree->rlink, fail, recourse);
/* Find, in the chain of fails going back to the root, the first
node that has a de... | @@ -643,6 +643,8 @@ bmexec_trans (kwset_t kwset, char const *text, size_t size)
if (! tp)
return -1;
tp++;
+ if (ep <= tp)
+ break;
}
}
} | CWE-119 | null | null |
4,195 | treenext (struct tree const *tree, struct trie *next[])
{
if (!tree)
return;
treenext(tree->llink, next);
treenext(tree->rlink, next);
next[tree->label] = tree->trie;
}
| DoS Overflow | 0 | treenext (struct tree const *tree, struct trie *next[])
{
if (!tree)
return;
treenext(tree->llink, next);
treenext(tree->rlink, next);
next[tree->label] = tree->trie;
}
| @@ -643,6 +643,8 @@ bmexec_trans (kwset_t kwset, char const *text, size_t size)
if (! tp)
return -1;
tp++;
+ if (ep <= tp)
+ break;
}
}
} | CWE-119 | null | null |
4,196 | cwd_is_root (char const *name)
{
unsigned int prefix_len = FILE_SYSTEM_PREFIX_LEN (name);
char root[prefix_len + 2];
struct stat st;
dev_t root_dev;
ino_t root_ino;
memcpy (root, name, prefix_len);
root[prefix_len] = '/';
root[prefix_len + 1] = 0;
if (stat (root, &st))
return false;
root_dev = ... | null | 0 | cwd_is_root (char const *name)
{
unsigned int prefix_len = FILE_SYSTEM_PREFIX_LEN (name);
char root[prefix_len + 2];
struct stat st;
dev_t root_dev;
ino_t root_ino;
memcpy (root, name, prefix_len);
root[prefix_len] = '/';
root[prefix_len + 1] = 0;
if (stat (root, &st))
return false;
root_dev = ... | @@ -454,6 +454,60 @@ name_is_valid (char const *name)
return is_valid;
}
+bool
+symlink_target_is_valid (char const *target, char const *to)
+{
+ bool is_valid;
+
+ if (IS_ABSOLUTE_FILE_NAME (to))
+ is_valid = true;
+ else if (IS_ABSOLUTE_FILE_NAME (target))
+ is_valid = false;
+ else
+ {
+ unsi... | CWE-59 | null | null |
4,197 | grow_hunkmax (void)
{
hunkmax *= 2;
assert (p_line && p_len && p_Char);
if ((p_line = (char **) realloc (p_line, hunkmax * sizeof (*p_line)))
&& (p_len = (size_t *) realloc (p_len, hunkmax * sizeof (*p_len)))
&& (p_Char = realloc (p_Char, hunkmax * sizeof (*p_Char))))
return true;
if (!using_pla... | null | 0 | grow_hunkmax (void)
{
hunkmax *= 2;
assert (p_line && p_len && p_Char);
if ((p_line = (char **) realloc (p_line, hunkmax * sizeof (*p_line)))
&& (p_len = (size_t *) realloc (p_len, hunkmax * sizeof (*p_len)))
&& (p_Char = realloc (p_Char, hunkmax * sizeof (*p_Char))))
return true;
if (!using_pla... | @@ -454,6 +454,60 @@ name_is_valid (char const *name)
return is_valid;
}
+bool
+symlink_target_is_valid (char const *target, char const *to)
+{
+ bool is_valid;
+
+ if (IS_ABSOLUTE_FILE_NAME (to))
+ is_valid = true;
+ else if (IS_ABSOLUTE_FILE_NAME (target))
+ is_valid = false;
+ else
+ {
+ unsi... | CWE-59 | null | null |
4,198 | open_patch_file (char const *filename)
{
file_offset file_pos = 0;
file_offset pos;
struct stat st;
if (!filename || !*filename || strEQ (filename, "-"))
pfp = stdin;
else
{
pfp = fopen (filename, binary_transput ? "rb" : "r");
if (!pfp)
pfatal ("Can't open patch file %s", quotearg... | null | 0 | open_patch_file (char const *filename)
{
file_offset file_pos = 0;
file_offset pos;
struct stat st;
if (!filename || !*filename || strEQ (filename, "-"))
pfp = stdin;
else
{
pfp = fopen (filename, binary_transput ? "rb" : "r");
if (!pfp)
pfatal ("Can't open patch file %s", quotearg... | @@ -454,6 +454,60 @@ name_is_valid (char const *name)
return is_valid;
}
+bool
+symlink_target_is_valid (char const *target, char const *to)
+{
+ bool is_valid;
+
+ if (IS_ABSOLUTE_FILE_NAME (to))
+ is_valid = true;
+ else if (IS_ABSOLUTE_FILE_NAME (target))
+ is_valid = false;
+ else
+ {
+ unsi... | CWE-59 | null | null |
4,199 | set_hunkmax (void)
{
if (!p_line)
p_line = (char **) malloc (hunkmax * sizeof *p_line);
if (!p_len)
p_len = (size_t *) malloc (hunkmax * sizeof *p_len);
if (!p_Char)
p_Char = malloc (hunkmax * sizeof *p_Char);
}
| null | 0 | set_hunkmax (void)
{
if (!p_line)
p_line = (char **) malloc (hunkmax * sizeof *p_line);
if (!p_len)
p_len = (size_t *) malloc (hunkmax * sizeof *p_len);
if (!p_Char)
p_Char = malloc (hunkmax * sizeof *p_Char);
}
| @@ -454,6 +454,60 @@ name_is_valid (char const *name)
return is_valid;
}
+bool
+symlink_target_is_valid (char const *target, char const *to)
+{
+ bool is_valid;
+
+ if (IS_ABSOLUTE_FILE_NAME (to))
+ is_valid = true;
+ else if (IS_ABSOLUTE_FILE_NAME (target))
+ is_valid = false;
+ else
+ {
+ unsi... | CWE-59 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.