OSDN Git Service

Fix possible access beyond end of memory mapped file
authorJochen Tucht <jtuc@users.sourceforge.net>
Wed, 19 May 2010 12:25:14 +0000 (12:25 +0000)
committerJochen Tucht <jtuc@users.sourceforge.net>
Wed, 19 May 2010 12:25:14 +0000 (12:25 +0000)
Src/codepage_detect.cpp

index 19c5de2..4d3757c 100644 (file)
@@ -223,7 +223,7 @@ void GuessCodepageEncoding(LPCTSTR filepath, FileTextEncoding * encoding, BOOL b
                encoding->m_bom = true;
                break;
        default:
-               if (fi.pImage && !CheckForInvalidUtf8((LPBYTE)fi.pImage, 4096))
+               if (fi.pImage && !CheckForInvalidUtf8((LPBYTE)fi.pImage, fi.cbImage))
                        encoding->SetUnicoding(ucr::UTF8);
                encoding->m_bom = false;
                break;