Commit 94fcc7f7 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

mkv: Don't pass std::string::npos to strndup

This seems to "confuse" some libc
parent 2577acf2
......@@ -381,7 +381,8 @@ void matroska_segment_c::ParseTrackEntry( const KaxTrackEntry *m )
{
free( vars.tk->fmt.psz_language );
const std::string slang ( lang );
vars.tk->fmt.psz_language = strndup( slang.c_str (), slang.find_first_of( '-' ) );
size_t pos = slang.find_first_of( '-' );
vars.tk->fmt.psz_language = pos != std::string::npos ? strndup( slang.c_str (), pos ) : strdup( slang.c_str() );
debug( vars, "Track Language=`%s'", vars.tk->fmt.psz_language ? vars.tk->fmt.psz_language : "(null)" );
}
E_CASE( KaxCodecID, codecid )
......
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