This is an automated email from the ASF dual-hosted git repository.
swebb2066 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/logging-log4cxx.git
The following commit(s) were added to refs/heads/master by this push:
new b1e4a73e Reduce stack overflow likelihood processing XML
configurations (#641)
b1e4a73e is described below
commit b1e4a73e8cb044e76454d25298e68cf2dd9a47b5
Author: Stephen Webb <[email protected]>
AuthorDate: Wed Apr 29 11:53:12 2026 +1000
Reduce stack overflow likelihood processing XML configurations (#641)
---
src/main/cpp/domconfigurator.cpp | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/src/main/cpp/domconfigurator.cpp b/src/main/cpp/domconfigurator.cpp
index 6daa4a3f..0f7352e9 100644
--- a/src/main/cpp/domconfigurator.cpp
+++ b/src/main/cpp/domconfigurator.cpp
@@ -218,24 +218,24 @@ Used internally to parse appenders by IDREF name.
AppenderPtr
DOMConfigurator::DOMConfiguratorPrivate::findAppenderByName(apr_xml_elem*
element, const LogString& appenderName)
{
AppenderPtr appender;
- std::string tagName(element->name);
- if (tagName == APPENDER_TAG)
+ while (element)
{
- if (appenderName == getAttribute(element, NAME_ATTR))
+ if (std::string(element->name) == APPENDER_TAG)
{
- appender = parseAppender(element);
+ if (appenderName == getAttribute(element, NAME_ATTR))
+ {
+ if (appender = parseAppender(element))
+ break;
+ }
}
- }
- if (element->first_child && !appender)
- {
- appender = findAppenderByName(element->first_child,
appenderName);
- }
-
- if (element->next && !appender)
- {
- appender = findAppenderByName(element->next, appenderName);
+ if (element->first_child)
+ {
+ if (appender = findAppenderByName(element->first_child,
appenderName))
+ break;
+ }
+ element = element->next;
}
return appender;