vici: Ignore NULL message in raise_event()
There are a lot of calls like this:
this->dispatcher->raise_event(this->dispatcher, "...", 0,
b->finalize(b));
However, if finalize() fails, e.g. because a previous call to add()
failed due to the size limit, it returns NULL. This then caused a
segmentation fault in raise_event() when it interacted with that value.
Closes strongswan/strongswan#1278
This commit is contained in:
@@ -60,6 +60,9 @@ START_TEST(test_event)
|
||||
ck_assert(vici_register(conn, "test", event_cb, &count) == 0);
|
||||
ck_assert(vici_register(conn, "nonexistent", event_cb, &count) != 0);
|
||||
|
||||
/* should just get ignored */
|
||||
dispatcher->raise_event(dispatcher, "test", 0, NULL);
|
||||
|
||||
dispatcher->raise_event(dispatcher, "test", 0, vici_message_create_from_args(
|
||||
VICI_KEY_VALUE, "key1", chunk_from_str("value1"),
|
||||
VICI_END));
|
||||
|
||||
@@ -497,6 +497,11 @@ METHOD(vici_dispatcher_t, raise_event, void,
|
||||
event_t *event;
|
||||
u_int *current;
|
||||
|
||||
if (!message)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this->mutex->lock(this->mutex);
|
||||
event = this->events->get(this->events, name);
|
||||
if (event)
|
||||
|
||||
Reference in New Issue
Block a user