Fix problem when subtitle file name is shorter than ".utf-8"

Patch by Evgeniy Stepanov < eugeni P stepanov A gmail P com >
Original thread:
Date: May 23, 2006 10:57 PM
Subject: [MPlayer-dev-eng] [BUG][PATCH] uninitialized memory access in subreader.c


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@18707 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
gpoirier 2006-06-14 11:19:39 +00:00
parent 83a9e75c4e
commit 30e68e8da7
1 changed files with 1 additions and 1 deletions

View File

@ -1398,7 +1398,7 @@ sub_data* sub_read_file (char *filename, float fps) {
if ((l=strlen(filename))>4){
char *exts[] = {".utf", ".utf8", ".utf-8" };
for (k=3;--k>=0;)
if (!strcasecmp(filename+(l - strlen(exts[k])), exts[k])){
if (l >= strlen(exts[k]) && !strcasecmp(filename+(l - strlen(exts[k])), exts[k])){
sub_utf8 = 1;
break;
}