Fix buffer overrun and double free problem.

This commit is contained in:
Jim Norman 2007-01-26 11:46:36 +00:00
parent 1ae3790b1b
commit de7dbd7b01

View File

@ -411,7 +411,7 @@ int count = 0;
// Add the name/value pair to the existing store....
if (count == 1)
{
uname = (char *) malloc(strlen(clearData)*sizeof(char));
uname = (char *) malloc(strlen(clearData)*sizeof(char) + 1);
strcpy(uname, clearData);
}
@ -427,6 +427,8 @@ int count = 0;
dataManager.AddHost(newHostName);
}
retValue = dataManager.AddHostElement(newHostName, name, clearData, isPassword);
if(count%2==0)
free(newHostName);
}
else