Commit a874fbbf authored by François Cartegnie's avatar François Cartegnie 🤞
Browse files

codec: substx3g: use strndup

parent 5cd17d17
...@@ -336,11 +336,9 @@ static int Decode( decoder_t *p_dec, block_t *p_block ) ...@@ -336,11 +336,9 @@ static int Decode( decoder_t *p_dec, block_t *p_block )
} }
else else
{ {
psz_subtitle = malloc( i_psz_bytelength + 1 ); psz_subtitle = strndup( (const char*) p_pszstart, i_psz_bytelength );
if ( !psz_subtitle ) if ( !psz_subtitle )
return VLCDEC_SUCCESS; return VLCDEC_SUCCESS;
memcpy( psz_subtitle, p_pszstart, i_psz_bytelength );
psz_subtitle[ i_psz_bytelength ] = '\0';
} }
p_buf += i_psz_bytelength + sizeof(uint16_t); p_buf += i_psz_bytelength + sizeof(uint16_t);
......
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