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,6 +427,8 @@ int count = 0;
|
||||
dataManager.AddHost(newHostName);
|
||||
}
|
||||
retValue = dataManager.AddHostElement(newHostName, name, clearData, isPassword);
|
||||
|
||||
if(count%2==0)
|
||||
free(newHostName);
|
||||
}
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user