Skip to content
Open
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
5 changes: 3 additions & 2 deletions apache2/persist_dbm.c
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@
/**
*
*/
int collection_store(modsec_rec *msr, apr_table_t *col) {

Check failure on line 359 in apache2/persist_dbm.c

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Refactor this function to reduce its Cognitive Complexity from 60 to the 25 allowed.

See more on https://sonarcloud.io/project/issues?id=owasp-modsecurity_ModSecurity&issues=AZ0ANfCngQqyHc8U2vBt&open=AZ0ANfCngQqyHc8U2vBt&pullRequest=3511
assert(msr != NULL);
char *dbm_filename = NULL;
msc_string *var_name = NULL, *var_key = NULL;
Expand Down Expand Up @@ -602,8 +602,9 @@

rc = apr_sdbm_store(dbm, key, value, APR_SDBM_REPLACE);
if (rc != APR_SUCCESS) {
msr_log(msr, 1, "collection_store: Failed to write to DBM file \"%s\": %s", dbm_filename,
get_apr_error(msr->mp, rc));
msr_log(msr, 1, "collection_store: Failed to write to DBM file \"%s\": %s (key=%s, length=%d)", dbm_filename,
get_apr_error(msr->mp, rc), key.dptr, key.dsize + value.dsize);
if ((key.dsize + value.dsize) > 1008) msr_log(msr, 1, "collection_store: key too long (name + value > 1008)");
if (dbm != NULL) {
#ifdef GLOBAL_COLLECTION_LOCK
apr_sdbm_close(dbm);
Expand Down
Loading