NOT PART OF BUILD. Fix flawfinder buffer issue.

This commit is contained in:
locka%iol.ie 2002-10-15 18:46:17 +00:00
Родитель 1ff1131541
Коммит 40db78c9e3
2 изменённых файлов: 34 добавлений и 37 удалений

Просмотреть файл

@ -41,7 +41,9 @@
#include "jni.h"
#include "npapi.h"
#include "nsISupports.h"
#include "nsString.h"
#ifdef MOZ_ACTIVEX_PLUGIN_XPCONNECT
#include "XPConnect.h"
@ -164,8 +166,7 @@ NPError NewControl(const char *pluginType,
{
// Read the parameters
CLSID clsid = CLSID_NULL;
tstring szName;
tstring szCodebase;
nsCAutoString codebase;
PropertyList pl;
if (strcmp(pluginType, MIME_OLEOBJECT1) != 0 &&
@ -187,43 +188,40 @@ NPError NewControl(const char *pluginType,
//
// The first example is the proper way
char szCLSID[256];
const kCLSIDLen = 256;
char szCLSID[kCLSIDLen];
if (strlen(argv[i]) < sizeof(szCLSID))
{
if (strnicmp(argv[i], "CLSID:", 6) == 0)
{
sprintf(szCLSID, "{%s}", argv[i]+6);
_snprintf(szCLSID, kCLSIDLen - 1, "{%s}", argv[i]+6);
}
else if(argv[i][0] != '{')
{
sprintf(szCLSID, "{%s}", argv[i]);
_snprintf(szCLSID, kCLSIDLen - 1, "{%s}", argv[i]);
}
else
{
strncpy(szCLSID, argv[i], sizeof(szCLSID));
strncpy(szCLSID, argv[i], kCLSIDLen - 1);
}
szCLSID[kCLSIDLen - 1] = '\0';
USES_CONVERSION;
CLSIDFromString(A2OLE(szCLSID), &clsid);
}
}
else if (stricmp(argn[i], "NAME") == 0)
{
USES_CONVERSION;
szName = tstring(A2T(argv[i]));
}
else if (stricmp(argn[i], "CODEBASE") == 0)
{
szCodebase = tstring(A2T(argv[i]));
codebase.Assign(argv[i]);
}
else
{
USES_CONVERSION;
std::wstring szName;
nsAutoString paramName;
if (strnicmp(argn[i], "PARAM_", 6) == 0)
{
szName = A2W(argn[i]+6);
paramName.AssignWithConversion(argn[i]+6);
}
else if (stricmp(argn[i], "PARAM") == 0)
{
@ -233,22 +231,22 @@ NPError NewControl(const char *pluginType,
}
else
{
szName = A2W(argn[i]);
paramName.AssignWithConversion(argn[i]);
}
// Empty parameters are ignored
if (szName.empty())
if (paramName.IsEmpty())
{
continue;
}
std::wstring szParam(A2W(argv[i]));
nsAutoString paramValue; paramValue.AssignWithConversion(argv[i]);
// Check for existing params with the same name
BOOL bFound = FALSE;
for (PropertyList::const_iterator i = pl.begin(); i != pl.end(); i++)
{
if (wcscmp((BSTR) (*i).szName, szName.c_str()) == 0)
if (wcscmp((BSTR) (*i).szName, paramName.get()) == 0)
{
bFound = TRUE;
break;
@ -261,7 +259,7 @@ NPError NewControl(const char *pluginType,
continue;
}
CComVariant vsValue(szParam.c_str());
CComVariant vsValue(paramValue.get());
CComVariant vIValue; // Value converted to int
CComVariant vRValue; // Value converted to real
CComVariant vBValue; // Value converted to bool
@ -284,7 +282,7 @@ NPError NewControl(const char *pluginType,
// Add named parameter to list
Property p;
p.szName = szName.c_str();
p.szName = paramName.get();
p.vValue = vValue;
pl.push_back(p);
}
@ -319,7 +317,7 @@ NPError NewControl(const char *pluginType,
// that specified in szCodebase
// Create the object
if (FAILED(pSite->Create(clsid, pl, szName)))
if (FAILED(pSite->Create(clsid, pl)))
{
USES_CONVERSION;
LPOLESTR szClsid;

Просмотреть файл

@ -62,11 +62,6 @@
#include "LegacyPlugin.h"
#include "XPConnect.h"
// TODO remove me
#ifdef MOZ_ACTIVEX_PLUGIN_WMPSUPPORT
#include "XPCMediaPlayer.h"
#endif
static NS_DEFINE_IID(kIClassInfoIID, NS_ICLASSINFO_IID);
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
@ -722,6 +717,8 @@ nsEventSink::InternalInvoke(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wF
return S_OK;
}
nsAutoString eventName(bstrName.m_str);
// TODO Turn VARIANT args into js objects
// Fire event to DOM 2 event listeners
@ -734,8 +731,7 @@ nsEventSink::InternalInvoke(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wF
eventReceiver->GetListenerManager(getter_AddRefs(eventManager));
if (eventManager)
{
nsAutoString keyName(bstrName.m_str);
nsStringKey key(keyName);
nsStringKey key(eventName);
nsEvent event;
event.message = NS_USER_DEFINED_EVENT;
event.userType = &key;
@ -785,13 +781,15 @@ nsEventSink::InternalInvoke(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wF
continue;
}
if (!forAttr.Equals(id)) // TODO compare no case?
if (!forAttr.Equals(id) ||
!eventAttr.Equals(eventName)) // TODO compare no case?
{
// Someone elses event
// Somebody elses event
continue;
}
// TODO fire the event
}
}
}
@ -908,12 +906,6 @@ void xpc_Release()
XPCOMGlueShutdown();
}
// TODO remove me
#ifdef MOZ_ACTIVEX_PLUGIN_WMPSUPPORT
const CLSID kWindowsMediaPlayer = {
0x6BF52A52, 0x394A, 0x11d3, { 0xB1, 0x53, 0x00, 0xC0, 0x4F, 0x79, 0xFA, 0xA6 } };
#endif
CLSID xpc_GetCLSIDForType(const char *mimeType)
{
if (mimeType == NULL)
@ -932,7 +924,7 @@ CLSID xpc_GetCLSIDForType(const char *mimeType)
{
USES_CONVERSION;
TCHAR szGUID[64];
ULONG nCount = 64;
ULONG nCount = (sizeof(szGUID) / sizeof(szGUID[0])) - 1;
GUID guidValue = GUID_NULL;
if (keyMimeType.QueryValue(_T("CLSID"), szGUID, &nCount) == ERROR_SUCCESS &&
@ -945,6 +937,13 @@ CLSID xpc_GetCLSIDForType(const char *mimeType)
return CLSID_NULL;
}
// TODO remove me
#ifdef MOZ_ACTIVEX_PLUGIN_WMPSUPPORT
#include "XPCMediaPlayer.h"
const CLSID kWindowsMediaPlayer = {
0x6BF52A52, 0x394A, 0x11d3, { 0xB1, 0x53, 0x00, 0xC0, 0x4F, 0x79, 0xFA, 0xA6 } };
#endif
nsScriptablePeer *
xpc_GetPeerForCLSID(const CLSID &clsid)
{