Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

db_oracle: Fix issues#3505 "invalid parameter value" when do sql_query("update ...") #3504

Merged
merged 2 commits into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions modules/db_oracle/dbase.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,11 +189,15 @@ int db_oracle_free_result(db_con_t* _h, db_res_t* _r)
{
ub4 i;

if (!_h || !_r) {
if (!_h) {
LM_ERR("invalid parameter value\n");
return -1;
}

if (!_r) {
return 0; /* nothing to free */
}

if (RES_NAMES(_r))
for (i=0; i < RES_COL_N(_r); ++i)
if (RES_NAMES(_r)[i]->s)
Expand Down Expand Up @@ -415,7 +419,6 @@ int db_oracle_raw_query(const db_con_t* _h, const str* _s, db_res_t** _r)
return -2;
}
#undef _S_DIFF
if (_r) goto badparam;
cb._rs = NULL;
}

Expand Down
7 changes: 6 additions & 1 deletion modules/db_oracle/res.c
Original file line number Diff line number Diff line change
Expand Up @@ -457,9 +457,14 @@ int db_oracle_store_result(const db_con_t* _h, db_res_t** _r)
query_data_t *pcb = con->pqdata;


if (!pcb || !pcb->_rs)
if (!pcb)
goto badparam;

if (!pcb->_rs) {
if (_r) *_r = NULL;
return 0; /* No results */
}

hs = *pcb->_rs;
pcb->_rs = NULL; /* paranoid for next call */
}
Expand Down
2 changes: 1 addition & 1 deletion modules/usrloc/dlist.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ static int get_domain_db_ucontacts(udomain_t *d, void *buf, int *len,

i = snprintf(query_buf, sizeof query_buf, "select %.*s, %.*s, %.*s,"
#ifdef ORACLE_USRLOC
" %.*s, %.*s, %.*s from %s where %.*s > %lu and mod(contact_id, %u) = %u",
" %.*s, %.*s, %.*s from %s where %.*s > %lld and mod(contact_id, %u) = %u",
#else
" %.*s, %.*s, %.*s from %s where %.*s > %lld and contact_id %% %u = %u",
#endif
Expand Down