From b49e9152ec4d7a8e043d1fb43e7bd39f460471b8 Mon Sep 17 00:00:00 2001 From: BlackLight Date: Tue, 15 Feb 2011 00:57:24 +0100 Subject: [PATCH] Fixing XML description < and > tags --- neural_cluster.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/neural_cluster.c b/neural_cluster.c index 81f2330..a757971 100644 --- a/neural_cluster.c +++ b/neural_cluster.c @@ -53,7 +53,9 @@ __AI_neural_clusters_to_xml ( kmeans_t *km, AI_alerts_per_neuron *alerts_per_neu char src_ip[INET_ADDRSTRLEN] = { 0 }, dst_ip[INET_ADDRSTRLEN] = { 0 }, - *timestamp = NULL; + *timestamp = NULL, + *tmp = NULL, + *buf = NULL; AI_alerts_per_neuron_key key; AI_alerts_per_neuron *alert_iterator = NULL; @@ -114,9 +116,14 @@ __AI_neural_clusters_to_xml ( kmeans_t *km, AI_alerts_per_neuron *alerts_per_neu timestamp = ctime ( &( alert_iterator->alerts[k].timestamp )); timestamp[ strlen ( timestamp ) - 1 ] = 0; + tmp = str_replace ( alert_iterator->alerts[k].desc, "<", "<" ); + buf = str_replace ( tmp, ">", ">" ); + free ( tmp ); + tmp = NULL; + fprintf ( fp, "\t\t\n", - alert_iterator->alerts[k].desc, + buf, alert_iterator->alerts[k].gid, alert_iterator->alerts[k].sid, alert_iterator->alerts[k].rev, @@ -124,6 +131,9 @@ __AI_neural_clusters_to_xml ( kmeans_t *km, AI_alerts_per_neuron *alerts_per_neu dst_ip, alert_iterator->alerts[k].dst_port, timestamp, alert_iterator->key.x, alert_iterator->key.y ); + + free ( buf ); + buf = NULL; } } }