mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-14 05:45:59 +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 *>(
|
if (m_containers.size() > 0) {
|
||||||
m_containers.back());
|
JSONContainerArray *a = dynamic_cast<JSONContainerArray *>(
|
||||||
if (a) {
|
m_containers.back());
|
||||||
a->m_elementCounter++;
|
if (a) {
|
||||||
|
a->m_elementCounter++;
|
||||||
|
} else {
|
||||||
|
data = getCurrentKey();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
data = getCurrentKey();
|
data = getCurrentKey();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
m_transaction->addArgument("JSON", path + data, value, 0);
|
m_transaction->addArgument("JSON", path + data, value, 0);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
@ -222,6 +227,10 @@ int JSON::yajl_start_array(void *ctx) {
|
|||||||
|
|
||||||
int JSON::yajl_end_array(void *ctx) {
|
int JSON::yajl_end_array(void *ctx) {
|
||||||
JSON *tthis = reinterpret_cast<JSON *>(ctx);
|
JSON *tthis = reinterpret_cast<JSON *>(ctx);
|
||||||
|
if (tthis->m_containers.size() <= 0) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
JSONContainer *a = tthis->m_containers.back();
|
JSONContainer *a = tthis->m_containers.back();
|
||||||
tthis->m_containers.pop_back();
|
tthis->m_containers.pop_back();
|
||||||
delete a;
|
delete a;
|
||||||
@ -252,6 +261,10 @@ int JSON::yajl_start_map(void *ctx) {
|
|||||||
*/
|
*/
|
||||||
int JSON::yajl_end_map(void *ctx) {
|
int JSON::yajl_end_map(void *ctx) {
|
||||||
JSON *tthis = reinterpret_cast<JSON *>(ctx);
|
JSON *tthis = reinterpret_cast<JSON *>(ctx);
|
||||||
|
if (tthis->m_containers.size() <= 0) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
JSONContainer *a = tthis->m_containers.back();
|
JSONContainer *a = tthis->m_containers.back();
|
||||||
tthis->m_containers.pop_back();
|
tthis->m_containers.pop_back();
|
||||||
delete a;
|
delete a;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user