mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-14 13:56:01 +03:00
Checking std::deque size before use it
This commit is contained in:
parent
2f86a6b708
commit
d0e2382507
@ -127,14 +127,19 @@ int JSON::addArgument(const std::string& value) {
|
||||
}
|
||||
}
|
||||
|
||||
JSONContainerArray *a = dynamic_cast<JSONContainerArray *>(
|
||||
m_containers.back());
|
||||
if (a) {
|
||||
a->m_elementCounter++;
|
||||
if (m_containers.size() > 0) {
|
||||
JSONContainerArray *a = dynamic_cast<JSONContainerArray *>(
|
||||
m_containers.back());
|
||||
if (a) {
|
||||
a->m_elementCounter++;
|
||||
} else {
|
||||
data = getCurrentKey();
|
||||
}
|
||||
} else {
|
||||
data = getCurrentKey();
|
||||
}
|
||||
|
||||
|
||||
m_transaction->addArgument("JSON", path + data, value, 0);
|
||||
|
||||
return 1;
|
||||
@ -222,6 +227,10 @@ int JSON::yajl_start_array(void *ctx) {
|
||||
|
||||
int JSON::yajl_end_array(void *ctx) {
|
||||
JSON *tthis = reinterpret_cast<JSON *>(ctx);
|
||||
if (tthis->m_containers.size() <= 0) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
JSONContainer *a = tthis->m_containers.back();
|
||||
tthis->m_containers.pop_back();
|
||||
delete a;
|
||||
@ -252,6 +261,10 @@ int JSON::yajl_start_map(void *ctx) {
|
||||
*/
|
||||
int JSON::yajl_end_map(void *ctx) {
|
||||
JSON *tthis = reinterpret_cast<JSON *>(ctx);
|
||||
if (tthis->m_containers.size() <= 0) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
JSONContainer *a = tthis->m_containers.back();
|
||||
tthis->m_containers.pop_back();
|
||||
delete a;
|
||||
|
Loading…
x
Reference in New Issue
Block a user