vlc | branch: master | Filip Roséen <[email protected]> | 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 <[email protected]> > 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; _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
