Fix buffer overrun and double free problem.
This commit is contained in:
parent
1ae3790b1b
commit
de7dbd7b01
@ -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,7 +427,9 @@ int count = 0;
|
||||
dataManager.AddHost(newHostName);
|
||||
}
|
||||
retValue = dataManager.AddHostElement(newHostName, name, clearData, isPassword);
|
||||
free(newHostName);
|
||||
|
||||
if(count%2==0)
|
||||
free(newHostName);
|
||||
}
|
||||
else
|
||||
retValue = dataManager.AddHostElement(hostName, name, clearData, isPassword);
|
||||
|
Loading…
Reference in New Issue
Block a user