vlc | branch: master | Francois Cartegnie <[email protected]> | Sun Nov 13 
20:20:18 2016 +0100| [1e88646c52013d9088a70562581eca36e831e4ec] | committer: 
Francois Cartegnie

demux: avi: fix potential NULL deref in GET_ATTACHMENTS

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

 modules/demux/avi/avi.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/modules/demux/avi/avi.c b/modules/demux/avi/avi.c
index 0820d88..97ded16 100644
--- a/modules/demux/avi/avi.c
+++ b/modules/demux/avi/avi.c
@@ -1728,11 +1728,15 @@ static int Control( demux_t *p_demux, int i_query, 
va_list args )
             input_attachment_t ***ppp_attach = va_arg( args, 
input_attachment_t*** );
             int *pi_int = va_arg( args, int * );
 
-            *pi_int     = p_sys->i_attachment;
-            *ppp_attach = calloc( p_sys->i_attachment, sizeof(**ppp_attach));
-            for( unsigned i = 0; i < p_sys->i_attachment && *ppp_attach; i++ )
-                (*ppp_attach)[i] = vlc_input_attachment_Duplicate( 
p_sys->attachment[i] );
-            return VLC_SUCCESS;
+            *ppp_attach = calloc( p_sys->i_attachment, sizeof(**ppp_attach) );
+            if( likely(*ppp_attach) )
+            {
+                *pi_int = p_sys->i_attachment;
+                for( unsigned i = 0; i < p_sys->i_attachment; i++ )
+                    (*ppp_attach)[i] = vlc_input_attachment_Duplicate( 
p_sys->attachment[i] );
+                return VLC_SUCCESS;
+            }
+            return VLC_EGENERIC;
         }
 
         default:

_______________________________________________
vlc-commits mailing list
[email protected]
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to