Commit ef2f7b9d authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont
Browse files

Put size check before data dereference

I think that's a good pattern to follow.
In this particular case, there was no bug however.
parent 9dc74649
...@@ -312,11 +312,11 @@ static inline int ps_pkt_size( const uint8_t *p, int i_peek ) ...@@ -312,11 +312,11 @@ static inline int ps_pkt_size( const uint8_t *p, int i_peek )
} }
else if( p[3] == 0xba ) else if( p[3] == 0xba )
{ {
if( (p[4] >> 6) == 0x01 && i_peek >= 14 ) if( i_peek >= 14 && (p[4] >> 6) == 0x01 )
{ {
return 14 + (p[13]&0x07); return 14 + (p[13]&0x07);
} }
else if( (p[4] >> 4) == 0x02 && i_peek >= 12 ) else if( i_peek >= 12 && (p[4] >> 4) == 0x02 )
{ {
return 12; return 12;
} }
......
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