diff --git a/xpcom/io/nsLocalFileOS2.cpp b/xpcom/io/nsLocalFileOS2.cpp index eacdd5ae206..313734aad53 100644 --- a/xpcom/io/nsLocalFileOS2.cpp +++ b/xpcom/io/nsLocalFileOS2.cpp @@ -2164,20 +2164,17 @@ nsLocalFile::IsExecutable(PRBool *_retval) if (pathEnd == leaf) return NS_OK; - // get the extension, including the dot - char* ext = (char*) _mbsrchr((const unsigned char*)leaf, '.'); - if (!ext) - return NS_OK; + // get the extension, including the dot, max. of 4 chars for comparison + // (copy the extension so that the original filename stays untouched) + char ext[5]; + strncpy(ext, (char*) _mbsrchr((const unsigned char*)leaf, '.'), 4); + ext[4] = '\0'; // ensure trailing nullbyte // upper-case the extension, then see if it claims to be an executable -#ifdef MOZ_OS2_HIGH_MEMORY // WinUpper() cannot be used because it crashes with high memory. // strupr() does not take into account non-ASCII characters but this is // irrelevant for the possible extensions below strupr(ext); -#else - WinUpper(0, 0, 0, ext); -#endif if (strcmp(ext, ".EXE") == 0 || strcmp(ext, ".CMD") == 0 || strcmp(ext, ".COM") == 0 ||