Fixing #13783 (garbage-pointer dereference)

This commit is contained in:
av%netscape.com 1999-10-02 00:41:03 +00:00
parent 1a8cdcbdc8
commit 70e29c914b
4 changed files with 8 additions and 2 deletions

View File

@ -109,6 +109,9 @@ nsPluginTag::nsPluginTag()
inline char* new_str(char* str)
{
if(str == nsnull)
return nsnull;
char* result = new char[strlen(str) + 1];
if (result != nsnull)
return strcpy(result, str);

View File

@ -92,7 +92,7 @@ static char** MakeStringArray(PRUint32 variants, char* data)
if((variants == 0) || (data == NULL))
return NULL;
buffer = (char **)PR_Malloc(variants * sizeof(char *));
buffer = (char **)PR_Calloc(variants, sizeof(char *));
if(!buffer)
return NULL;
buffer[count] = index;

View File

@ -109,6 +109,9 @@ nsPluginTag::nsPluginTag()
inline char* new_str(char* str)
{
if(str == nsnull)
return nsnull;
char* result = new char[strlen(str) + 1];
if (result != nsnull)
return strcpy(result, str);

View File

@ -92,7 +92,7 @@ static char** MakeStringArray(PRUint32 variants, char* data)
if((variants == 0) || (data == NULL))
return NULL;
buffer = (char **)PR_Malloc(variants * sizeof(char *));
buffer = (char **)PR_Calloc(variants, sizeof(char *));
if(!buffer)
return NULL;
buffer[count] = index;