Allow no-key, single-value JSON body

This commit is contained in:
Martin Vierula
2022-05-03 12:34:03 -07:00
parent 733427197e
commit 4a98032b7f
4 changed files with 38 additions and 3 deletions

View File

@@ -27,8 +27,7 @@ int json_add_argument(modsec_rec *msr, const char *value, unsigned length)
* to reference this argument; for now we simply ignore these
*/
if (!msr->json->current_key) {
msr_log(msr, 3, "Cannot add scalar value without an associated key");
return 1;
msr->json->current_key = "";
}
arg = (msc_arg *) apr_pcalloc(msr->mp, sizeof(msc_arg));

View File

@@ -39,7 +39,7 @@ struct json_data {
/* prefix is used to create data hierarchy (i.e., 'parent.child.value') */
unsigned char *prefix;
unsigned char *current_key;
const unsigned char *current_key;
long int current_depth;
int depth_limit_exceeded;
};