[syslog-ng] [PATCH] [patterndb] fix a missing XML semantic check in PDBLoader
balint.kovacs at balabit.com
balint.kovacs at balabit.com
Tue Nov 27 09:06:34 CET 2012
From: Balint Kovacs <blint at blint.hu>
pattnerndb has failed to check if we are within a rule when trying to
add tags and values, so a patterndb xml containing these elements
outside of a rule element would cause syslog-ng (and pdbtool) to
segfault
Signed-off-by: Balint Kovacs <blint at blint.hu>
---
modules/dbparser/patterndb.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/modules/dbparser/patterndb.c b/modules/dbparser/patterndb.c
index 004d6b7..d2349f6 100644
--- a/modules/dbparser/patterndb.c
+++ b/modules/dbparser/patterndb.c
@@ -1154,10 +1154,20 @@ pdb_loader_text(GMarkupParseContext *context, const gchar *text, gsize text_len,
}
else if (state->in_tag)
{
+ if (!state->in_rule)
+ {
+ *error = g_error_new(1, 0, "Unexpected <tag> element, must be within a rule");
+ return;
+ }
pdb_message_add_tag(state->current_message, text);
}
else if (state->value_name)
{
+ if (!state->in_rule)
+ {
+ *error = g_error_new(1, 0, "Unexpected <value> element, must be within a rule");
+ return;
+ }
if (!state->current_message->values)
state->current_message->values = g_ptr_array_new();
--
1.7.9.5
More information about the syslog-ng
mailing list