Commit f6d9eb72 authored by Legodev's avatar Legodev

ADDED: string length limitation to 64 Kibibytes

parent 38a05dd2
......@@ -154,6 +154,19 @@ int character_mysql::setData(unsigned int arraypos, std::string variableValue) {
char * pointer = (char *) mysql_bind[arraypos].buffer;
int size = variableValue.size();
// the database text fields are of the MySQL datatype TEXT, which can store 64 Kibibytes data
// if our string is longer then these 64 Kibibytes we discard the data because truncation causes serious issues
if (size >= 65530) {
this->setNull(arraypos);
mysql_bind[arraypos].buffer = 0;
mysql_bind[arraypos].buffer_length = 0;
free(pointer);
pointer = 0;
return 0;
}
if (pointer == 0 || std::string(pointer) != variableValue) {
if (pointer != 0 && mysql_bind[arraypos].buffer_length < size) {
mysql_bind[arraypos].buffer = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment