Added more restrictive check for what constitutes a plugin

git-svn-id: svn://10.0.0.236/trunk@25929 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
amusil%netscape.com
1999-04-01 22:06:07 +00:00
parent 010cefefb1
commit c35f2ea671
2 changed files with 16 additions and 6 deletions

View File

@@ -182,6 +182,7 @@ nsPluginsDir::~nsPluginsDir()
PRBool nsPluginsDir::IsPluginFile(const nsFileSpec& fileSpec)
{
const char* filename;
char* extension;
PRUint32 len;
const char* pathname = fileSpec.GetCString();
@@ -194,13 +195,17 @@ PRBool nsPluginsDir::IsPluginFile(const nsFileSpec& fileSpec)
len = PL_strlen(filename);
// the filename must be: "np*.dll"
extension = PL_strrchr(filename, '.');
if(extension)
++extension;
if(len > 5)
{
if(filename[0] == 'n' && filename[1] == 'p')
return true;
if(!PL_strncasecmp(filename, "np", 2) && !PL_strcasecmp(extension, "dll"))
return PR_TRUE;
}
return false;
return PR_FALSE;
}
///////////////////////////////////////////////////////////////////////////

View File

@@ -182,6 +182,7 @@ nsPluginsDir::~nsPluginsDir()
PRBool nsPluginsDir::IsPluginFile(const nsFileSpec& fileSpec)
{
const char* filename;
char* extension;
PRUint32 len;
const char* pathname = fileSpec.GetCString();
@@ -194,13 +195,17 @@ PRBool nsPluginsDir::IsPluginFile(const nsFileSpec& fileSpec)
len = PL_strlen(filename);
// the filename must be: "np*.dll"
extension = PL_strrchr(filename, '.');
if(extension)
++extension;
if(len > 5)
{
if(filename[0] == 'n' && filename[1] == 'p')
return true;
if(!PL_strncasecmp(filename, "np", 2) && !PL_strcasecmp(extension, "dll"))
return PR_TRUE;
}
return false;
return PR_FALSE;
}
///////////////////////////////////////////////////////////////////////////