[vlc-devel] [PATCH] avoid potential null deref in module_config_get()
Alexandre Janniaux
ajanni at videolabs.io
Thu Sep 17 23:03:44 CEST 2020
Hi,
Patch LGTM, but the commit message is not correct regarding
what the patch is doing, since it doesn't change any potential
NULL dereference.
On Thu, Sep 17, 2020 at 07:27:52PM +0100, Lyndon Brown wrote:
>From e4cc084a55947028177fdf0689b0902aedd355de Mon Sep 17 00:00:00 2001
From: Lyndon Brown <jnqnfe at gmail.com>
Date: Fri, 29 Mar 2019 01:03:23 +0000
Subject: modules: avoid potential null dereference
diff --git a/src/modules/modules.c b/src/modules/modules.c
index 4334afdcbd..ee47ec30c3 100644
--- a/src/modules/modules.c
+++ b/src/modules/modules.c
@@ -358,23 +358,22 @@ module_config_t *module_config_get( const module_t *module, unsigned *restrict p
{
const vlc_plugin_t *plugin = module->plugin;
+ assert( psize != NULL );
+ *psize = 0;
+
if (plugin->module != module)
{ /* For backward compatibility, pretend non-first modules have no
* configuration items. */
- *psize = 0;
return NULL;
}
- unsigned i,j;
size_t size = plugin->conf.size;
module_config_t *config = vlc_alloc( size, sizeof( *config ) );
- assert( psize != NULL );
- *psize = 0;
-
if( !config )
return NULL;
+ unsigned i, j;
for( i = 0, j = 0; i < size; i++ )
{
const module_config_t *item = plugin->conf.items + i;
More information about the vlc-devel
mailing list