]> Devoid-pointer.net GitWeb - KLGD.git/commitdiff
Do not post events to invalid plugins
authorMichal Malý <madcatxster@devoid-pointer.net>
Sun, 27 Jul 2014 08:38:06 +0000 (10:38 +0200)
committerMichal Malý <madcatxster@devoid-pointer.net>
Sun, 27 Jul 2014 08:38:06 +0000 (10:38 +0200)
klgd.c

diff --git a/klgd.c b/klgd.c
index d9cfe821935a964c2243ae26d0f61fd5a4496ad3..eea23a4bb53790ac562203a9c46c266c43fe7d42 100644 (file)
--- a/klgd.c
+++ b/klgd.c
@@ -194,6 +194,9 @@ int klgd_post_event(struct klgd_main *ctx, size_t idx, void *data)
        struct klgd_plugin *plugin = ctx->private->plugins[idx];
        int ret;
 
+       if (!plugin || idx >= ctx->private->plugin_count)
+               return -EINVAL;
+
        mutex_lock(&ctx->private->stream_mlock);
        ret = plugin->post_event(plugin, data);
        if (ret) {