Fix buffer overrun and double free problem.
This commit is contained in:
		| @@ -411,7 +411,7 @@ int count = 0; | |||||||
| 				// Add the name/value pair to the existing store.... | 				// Add the name/value pair to the existing store.... | ||||||
| 				if (count == 1) | 				if (count == 1) | ||||||
| 				{ | 				{ | ||||||
| 					uname = (char *) malloc(strlen(clearData)*sizeof(char)); | 					uname = (char *) malloc(strlen(clearData)*sizeof(char) + 1); | ||||||
| 					strcpy(uname, clearData); | 					strcpy(uname, clearData); | ||||||
| 				} | 				} | ||||||
| 				 | 				 | ||||||
| @@ -427,6 +427,8 @@ int count = 0; | |||||||
| 						dataManager.AddHost(newHostName); | 						dataManager.AddHost(newHostName); | ||||||
| 					} | 					} | ||||||
| 					retValue = dataManager.AddHostElement(newHostName, name, clearData, isPassword); | 					retValue = dataManager.AddHostElement(newHostName, name, clearData, isPassword); | ||||||
|  |  | ||||||
|  | 					if(count%2==0) | ||||||
| 						free(newHostName); | 						free(newHostName); | ||||||
| 				} | 				} | ||||||
| 				else | 				else | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user