From 543bea32e16bbe317171d24888a5f0c751ea19e8 Mon Sep 17 00:00:00 2001 From: Shauren Date: Sun, 9 Nov 2014 16:57:56 +0100 Subject: Core/DBLayer: Fixed a few mismatched types and possible invalid memory access with aggregate fields in queries --- src/server/shared/Database/Field.cpp | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'src/server/shared/Database/Field.cpp') diff --git a/src/server/shared/Database/Field.cpp b/src/server/shared/Database/Field.cpp index f1741f98cc3..da547d3a151 100644 --- a/src/server/shared/Database/Field.cpp +++ b/src/server/shared/Database/Field.cpp @@ -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(data.value) + length) = '\0'; - } - else - data.value = new char[length]; - + data.value = new char[length + 1]; memcpy(data.value, newValue, length); + *(reinterpret_cast(data.value) + length) = '\0'; data.length = length; } -- cgit v1.2.3