Core/DBLayer: Fixed a few mismatched types and possible invalid memory access with aggregate fields in queries

This commit is contained in:
Shauren
2014-11-09 16:57:56 +01:00
parent 18cce601b9
commit 543bea32e1
5 changed files with 18 additions and 18 deletions

View File

@@ -46,7 +46,7 @@ void Field::SetByteValue(const void* newValue, const size_t newSize, enum_field_
data.raw = true;
}
void Field::SetStructuredValue(char* newValue, enum_field_types newType, uint32 length, bool isBinary)
void Field::SetStructuredValue(char* newValue, enum_field_types newType, uint32 length)
{
if (data.value)
CleanUp();
@@ -54,15 +54,9 @@ void Field::SetStructuredValue(char* newValue, enum_field_types newType, uint32
// This value stores somewhat structured data that needs function style casting
if (newValue)
{
if (!isBinary)
{
data.value = new char[length + 1];
*(reinterpret_cast<char*>(data.value) + length) = '\0';
}
else
data.value = new char[length];
data.value = new char[length + 1];
memcpy(data.value, newValue, length);
*(reinterpret_cast<char*>(data.value) + length) = '\0';
data.length = length;
}