Commit a213a50b authored by Christophe Massiot's avatar Christophe Massiot

* en50221.c: Fix a segfault with invalid CAM message.

parent def9791c
...@@ -761,7 +761,9 @@ static void SPDUHandle( access_t * p_access, uint8_t i_slot, ...@@ -761,7 +761,9 @@ static void SPDUHandle( access_t * p_access, uint8_t i_slot,
case ST_SESSION_NUMBER: case ST_SESSION_NUMBER:
if ( i_size <= 4 ) if ( i_size <= 4 )
return; return;
i_session_id = ((int)p_spdu[2] << 8) | p_spdu[3]; i_session_id = (p_spdu[2] << 8) | p_spdu[3];
if ( i_session_id <= MAX_SESSIONS
&& p_sessions[i_session_id - 1].pf_handle != NULL )
p_sessions[i_session_id - 1].pf_handle( p_access, i_session_id, p_sessions[i_session_id - 1].pf_handle( p_access, i_session_id,
p_spdu + 4, i_size - 4 ); p_spdu + 4, i_size - 4 );
break; break;
...@@ -1874,6 +1876,15 @@ static void ResetSlot( int i_slot ) ...@@ -1874,6 +1876,15 @@ static void ResetSlot( int i_slot )
ci_slot_t *p_slot = &p_slots[i_slot]; ci_slot_t *p_slot = &p_slots[i_slot];
int i_session_id; int i_session_id;
switch (i_print_type)
{
case PRINT_XML:
printf("<STATUS type=\"cam\" status=\"0\" />\n");
break;
default:
break;
}
if ( ioctl( i_ca_handle, CA_RESET, 1 << i_slot ) != 0 ) if ( ioctl( i_ca_handle, CA_RESET, 1 << i_slot ) != 0 )
msg_Err( NULL, "en50221_Poll: couldn't reset slot %d", i_slot ); msg_Err( NULL, "en50221_Poll: couldn't reset slot %d", i_slot );
p_slot->b_active = false; p_slot->b_active = false;
...@@ -1998,15 +2009,6 @@ void en50221_Init( void ) ...@@ -1998,15 +2009,6 @@ void en50221_Init( void )
*****************************************************************************/ *****************************************************************************/
void en50221_Reset( void ) void en50221_Reset( void )
{ {
switch (i_print_type)
{
case PRINT_XML:
printf("<STATUS type=\"cam\" status=\"0\" />\n");
break;
default:
break;
}
memset( p_slots, 0, sizeof(ci_slot_t) * MAX_CI_SLOTS ); memset( p_slots, 0, sizeof(ci_slot_t) * MAX_CI_SLOTS );
if( i_ca_type & CA_CI_LINK ) if( i_ca_type & CA_CI_LINK )
......
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