mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-09-30 03:34:29 +03:00
Added some null pointer checks.
Added a design doc.
This commit is contained in:
@@ -87,6 +87,7 @@ int json_add_argument(modsec_rec *msr, const char *value, unsigned length)
|
||||
static int yajl_map_key(void *ctx, const unsigned char *key, size_t length)
|
||||
{
|
||||
modsec_rec *msr = (modsec_rec *) ctx;
|
||||
assert(msr != NULL);
|
||||
unsigned char *safe_key = (unsigned char *) NULL;
|
||||
|
||||
/**
|
||||
@@ -118,6 +119,7 @@ static int yajl_map_key(void *ctx, const unsigned char *key, size_t length)
|
||||
static int yajl_null(void *ctx)
|
||||
{
|
||||
modsec_rec *msr = (modsec_rec *) ctx;
|
||||
assert(msr != NULL);
|
||||
|
||||
return json_add_argument(msr, "", 0);
|
||||
}
|
||||
@@ -128,6 +130,7 @@ static int yajl_null(void *ctx)
|
||||
static int yajl_boolean(void *ctx, int value)
|
||||
{
|
||||
modsec_rec *msr = (modsec_rec *) ctx;
|
||||
assert(msr != NULL);
|
||||
|
||||
if (value) {
|
||||
return json_add_argument(msr, "true", strlen("true"));
|
||||
@@ -143,6 +146,7 @@ static int yajl_boolean(void *ctx, int value)
|
||||
static int yajl_string(void *ctx, const unsigned char *value, size_t length)
|
||||
{
|
||||
modsec_rec *msr = (modsec_rec *) ctx;
|
||||
assert(msr != NULL);
|
||||
|
||||
return json_add_argument(msr, value, length);
|
||||
}
|
||||
@@ -155,12 +159,14 @@ static int yajl_string(void *ctx, const unsigned char *value, size_t length)
|
||||
static int yajl_number(void *ctx, const char *value, size_t length)
|
||||
{
|
||||
modsec_rec *msr = (modsec_rec *) ctx;
|
||||
assert(msr != NULL);
|
||||
|
||||
return json_add_argument(msr, value, length);
|
||||
}
|
||||
|
||||
static int yajl_start_array(void *ctx) {
|
||||
modsec_rec *msr = (modsec_rec *) ctx;
|
||||
assert(msr != NULL);
|
||||
|
||||
if (!msr->json->current_key && !msr->json->prefix) {
|
||||
msr->json->prefix = apr_pstrdup(msr->mp, "array");
|
||||
@@ -190,6 +196,7 @@ static int yajl_start_array(void *ctx) {
|
||||
|
||||
static int yajl_end_array(void *ctx) {
|
||||
modsec_rec *msr = (modsec_rec *) ctx;
|
||||
assert(msr != NULL);
|
||||
unsigned char *separator = (unsigned char *) NULL;
|
||||
|
||||
/**
|
||||
@@ -226,6 +233,7 @@ static int yajl_end_array(void *ctx) {
|
||||
static int yajl_start_map(void *ctx)
|
||||
{
|
||||
modsec_rec *msr = (modsec_rec *) ctx;
|
||||
assert(msr != NULL);
|
||||
|
||||
/**
|
||||
* If we do not have a current_key, this is a top-level hash, so we do not
|
||||
@@ -264,6 +272,7 @@ static int yajl_start_map(void *ctx)
|
||||
static int yajl_end_map(void *ctx)
|
||||
{
|
||||
modsec_rec *msr = (modsec_rec *) ctx;
|
||||
assert(msr != NULL);
|
||||
unsigned char *separator = (unsigned char *) NULL;
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user