prelude: don't build string objet for NULL string

prelude_string_set_ref don't like when it is called with a NULL
parameter. This patch adds check for NULL value. This is formally
good as there is no use of a NULL description.
pull/231/head
Eric Leblond 12 years ago
parent 005f7a2399
commit 06751ecd75

@ -249,11 +249,13 @@ static int EventToImpact(PacketAlert *pa, Packet *p, idmef_alert_t *alert)
idmef_assessment_set_action(assessment, action, 0);
}
ret = idmef_impact_new_description(impact, &str);
if ( ret < 0 )
SCReturnInt(ret);
if (pa->s->class_msg) {
ret = idmef_impact_new_description(impact, &str);
if ( ret < 0 )
SCReturnInt(ret);
prelude_string_set_ref(str, pa->s->class_msg);
prelude_string_set_ref(str, pa->s->class_msg);
}
SCReturnInt(0);
}
@ -693,11 +695,13 @@ TmEcode AlertPrelude (ThreadVars *tv, Packet *p, void *data, PacketQueue *pq, Pa
if ( ret < 0 )
goto err;
ret = idmef_classification_new_text(class, &str);
if ( ret < 0 )
goto err;
if (pa->s->msg) {
ret = idmef_classification_new_text(class, &str);
if ( ret < 0 )
goto err;
prelude_string_set_ref(str, pa->s->msg);
prelude_string_set_ref(str, pa->s->msg);
}
ret = EventToImpact(pa, p, alert);
if ( ret < 0 )

Loading…
Cancel
Save