Skip to content

Commit 2b3d092

Browse files
authored
Merge pull request owasp-modsecurity#3139 from marcstern/v2/mst/SecArgumentsLimit_log
Enhanced logging [Issue owasp-modsecurity#3107]
2 parents d9016e2 + 746f57f commit 2b3d092

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

CHANGES

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
DD mmm YYYY - 2.9.x (to be released)
22
-------------------
33

4+
* Enhance logging
5+
[Issue #3107 - @marcstern]
46
* Fix possible segfault in collection_unpack
57
[Issue #3072 - @twouters]
68
* Set the minimum security protocol version for SecRemoteRules

apache2/msc_json.c

+7-3
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ int json_add_argument(modsec_rec *msr, const char *value, unsigned length)
6565
log_escape_ex(msr->mp, arg->value, arg->value_len));
6666
}
6767
msr->msc_reqbody_error = 1;
68+
msr->json->yajl_error = apr_psprintf(msr->mp, "More than %ld JSON keys", msr->txcfg->arguments_limit);
6869
return 0;
6970
}
7071

@@ -374,9 +375,12 @@ int json_process_chunk(modsec_rec *msr, const char *buf, unsigned int size, char
374375
if (msr->json->depth_limit_exceeded) {
375376
*error_msg = "JSON depth limit exceeded";
376377
} else {
377-
char *yajl_err = yajl_get_error(msr->json->handle, 0, buf, size);
378-
*error_msg = apr_pstrdup(msr->mp, yajl_err);
379-
yajl_free_error(msr->json->handle, yajl_err);
378+
if (msr->json->yajl_error) *error_msg = msr->json->yajl_error;
379+
else {
380+
char* yajl_err = yajl_get_error(msr->json->handle, 0, buf, size);
381+
*error_msg = apr_pstrdup(msr->mp, yajl_err);
382+
yajl_free_error(msr->json->handle, yajl_err);
383+
}
380384
}
381385
return -1;
382386
}

0 commit comments

Comments
 (0)