Commit 45296a17 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

mp4: use strndup() where applicable

As a side note, this fixes a valgrind heap read overflow, but I do not
see why. I suspect a conflict between valgrind and some optimization in
libc or gcc here.
parent a5ebee89
...@@ -3609,11 +3609,9 @@ static void get_token( char **ppsz_path, char **ppsz_token, int *pi_number ) ...@@ -3609,11 +3609,9 @@ static void get_token( char **ppsz_path, char **ppsz_token, int *pi_number )
{ {
i_len = 1; i_len = 1;
} }
*ppsz_token = xmalloc( i_len + 1 ); *ppsz_token = strndup( *ppsz_path, i_len );
if( unlikely(!*ppsz_token) )
memcpy( *ppsz_token, *ppsz_path, i_len ); abort();
(*ppsz_token)[i_len] = '\0';
*ppsz_path += i_len; *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