Skip to content

Commit 3e95614

Browse files
committed
Add nullptr check conditions
1 parent b42602f commit 3e95614

File tree

1 file changed

+14
-7
lines changed
  • src/request_body_processor

1 file changed

+14
-7
lines changed

src/request_body_processor/xml.cc

+14-7
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,8 @@ bool XML::processChunk(const char *buf, unsigned int size,
254254
}
255255

256256
/* Not a first invocation. */
257-
if (m_transaction->m_secXMLParseXmlIntoArgs
257+
if (m_data.parsing_ctx != NULL &&
258+
m_transaction->m_secXMLParseXmlIntoArgs
258259
!= RulesSetProperties::OnlyArgsConfigXMLParseXmlIntoArgs) {
259260
xmlSetGenericErrorFunc(m_data.parsing_ctx, null_error);
260261
xmlParseChunk(m_data.parsing_ctx, buf, size, 0);
@@ -266,7 +267,8 @@ bool XML::processChunk(const char *buf, unsigned int size,
266267
}
267268
}
268269

269-
if (m_transaction->m_secXMLParseXmlIntoArgs
270+
if (m_data.parsing_ctx_arg != NULL &&
271+
m_transaction->m_secXMLParseXmlIntoArgs
270272
== RulesSetProperties::OnlyArgsConfigXMLParseXmlIntoArgs ||
271273
m_transaction->m_secXMLParseXmlIntoArgs
272274
== RulesSetProperties::TrueConfigXMLParseXmlIntoArgs) {
@@ -286,7 +288,8 @@ bool XML::processChunk(const char *buf, unsigned int size,
286288
bool XML::complete(std::string *error) {
287289
/* Only if we have a context, meaning we've done some work. */
288290
if (m_data.parsing_ctx != NULL || m_data.parsing_ctx_arg != NULL) {
289-
if (m_transaction->m_secXMLParseXmlIntoArgs
291+
if (m_data.parsing_ctx != NULL &&
292+
m_transaction->m_secXMLParseXmlIntoArgs
290293
!= RulesSetProperties::OnlyArgsConfigXMLParseXmlIntoArgs) {
291294
/* This is how we signalise the end of parsing to libxml. */
292295
xmlParseChunk(m_data.parsing_ctx, NULL, 0, 1);
@@ -307,10 +310,14 @@ bool XML::complete(std::string *error) {
307310
return false;
308311
}
309312
}
310-
if (m_transaction->m_secXMLParseXmlIntoArgs
311-
== RulesSetProperties::OnlyArgsConfigXMLParseXmlIntoArgs ||
312-
m_transaction->m_secXMLParseXmlIntoArgs
313-
== RulesSetProperties::TrueConfigXMLParseXmlIntoArgs) {
313+
if (m_data.parsing_ctx_arg != NULL &&
314+
(
315+
m_transaction->m_secXMLParseXmlIntoArgs
316+
== RulesSetProperties::OnlyArgsConfigXMLParseXmlIntoArgs
317+
||
318+
m_transaction->m_secXMLParseXmlIntoArgs
319+
== RulesSetProperties::TrueConfigXMLParseXmlIntoArgs)
320+
) {
314321
/* This is how we signalise the end of parsing to libxml. */
315322
if (xmlParseChunk(m_data.parsing_ctx_arg, NULL, 0, 1) != 0) {
316323
if (m_data.xml_error != "") {

0 commit comments

Comments
 (0)