Commit 346ae7a9 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

MP4: use strcpsn() and check one malloc()

parent 11cd9e3c
...@@ -3203,17 +3203,12 @@ static void get_token( char **ppsz_path, char **ppsz_token, int *pi_number ) ...@@ -3203,17 +3203,12 @@ static void get_token( char **ppsz_path, char **ppsz_token, int *pi_number )
*pi_number = 0; *pi_number = 0;
return; return;
} }
i_len = 0; i_len = strcspn( *ppsz_path, "/[" );
while( (*ppsz_path)[i_len] &&
(*ppsz_path)[i_len] != '/' && (*ppsz_path)[i_len] != '[' )
{
i_len++;
}
if( !i_len && **ppsz_path == '/' ) if( !i_len && **ppsz_path == '/' )
{ {
i_len = 1; i_len = 1;
} }
*ppsz_token = malloc( i_len + 1 ); *ppsz_token = xmalloc( i_len + 1 );
memcpy( *ppsz_token, *ppsz_path, i_len ); memcpy( *ppsz_token, *ppsz_path, i_len );
......
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