gobbledegook
gobbledegook copied to clipboard
Utils::stringFromGVariantByteArray will return bogus data if array contains a byte = 0
master version creates a vector of defined length. This vector is filled with data from GVariant. Problem is that vector data is fed to constructor of std::string as initializer in return statement. Constructor will treat this data as a null terminated null string which will stop copying data from vector if a byte = 0 is found in data.
Current code
std::vector<gchar> array(size + 1, 0);
memcpy(array.data(), pPtr, size);
return array.data();
Proposed code
std::basic_string<gchar> array(size + 1, 0);
return array;