Commit d9d659fc authored by Gildas Bazin's avatar Gildas Bazin

* fixed array over-run bug in intf_MsgUnsub
parent 1aca1d70
......@@ -4,7 +4,7 @@
* interface, such as message output. See config.h for output configuration.
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: intf_msg.c,v 1.45 2002/02/20 05:56:18 sam Exp $
* $Id: intf_msg.c,v 1.46 2002/02/23 21:31:44 gbazin Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
*
......@@ -142,7 +142,7 @@ intf_subscription_t *intf_MsgSub( void )
}
/*****************************************************************************
* intf_MsgSub: unsubscribe from the message queue.
* intf_MsgUnsub: unsubscribe from the message queue.
*****************************************************************************/
void intf_MsgUnsub( intf_subscription_t *p_sub )
{
......@@ -150,6 +150,13 @@ void intf_MsgUnsub( intf_subscription_t *p_sub )
vlc_mutex_lock( &msg_bank.lock );
/* Sanity check */
if( !msg_bank.i_sub )
{
intf_ErrMsg( "intf error: no subscriber in the list" );
return;
}
/* Look for the appropriate subscription */
for( i_index = 0; i_index < msg_bank.i_sub; i_index++ )
{
......@@ -167,7 +174,7 @@ void intf_MsgUnsub( intf_subscription_t *p_sub )
}
/* Remove this subscription */
for( ; i_index < msg_bank.i_sub; i_index++ )
for( ; i_index < (msg_bank.i_sub - 1); i_index++ )
{
msg_bank.pp_sub[ i_index ] = msg_bank.pp_sub[ i_index+1 ];
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment