[vlc-commits] modules/bank: prevent null-pointer dereference in AllocatePluginFile

Filip Roséen git at videolan.org
Fri Oct 28 09:09:17 CEST 2016


vlc | branch: master | Filip Roséen <filip at atch.se> | Fri Oct 28 08:52:01 2016 +0200| [a6526c57e72299c7af8dc28905a0f8bdc0f8487c] | committer: Rémi Denis-Courmont

modules/bank: prevent null-pointer dereference in AllocatePluginFile

Given that module_InitDynamic can fail and return a NULL pointer to
signal the error, we cannot unconditionally set data-members of the
referred to vlc_plugin_t.

These changes fixes the issue by introducing an explicit branch
related to initialization.

Signed-off-by: Rémi Denis-Courmont <remi at remlab.net>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a6526c57e72299c7af8dc28905a0f8bdc0f8487c
---

 src/modules/bank.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/modules/bank.c b/src/modules/bank.c
index c202eb2..3867337 100644
--- a/src/modules/bank.c
+++ b/src/modules/bank.c
@@ -188,10 +188,15 @@ static int AllocatePluginFile (module_bank_t *bank, const char *abspath,
     if (plugin == NULL)
     {
         plugin = module_InitDynamic(bank->obj, abspath, true);
-        plugin->path = xstrdup(relpath);
-        plugin->mtime = st->st_mtime;
-        plugin->size = st->st_size;
+
+        if (plugin != NULL)
+        {
+            plugin->path = xstrdup(relpath);
+            plugin->mtime = st->st_mtime;
+            plugin->size = st->st_size;
+        }
     }
+
     if (plugin == NULL)
         return -1;
 



More information about the vlc-commits mailing list