diff --git a/src/plugins/c/items/c_item_string.cpp b/src/plugins/c/items/c_item_string.cpp index 91eac79..a0fbab5 100644 --- a/src/plugins/c/items/c_item_string.cpp +++ b/src/plugins/c/items/c_item_string.cpp @@ -54,6 +54,7 @@ CItemString::GenerateSetterDefinition(std::string message_id) const std::stringstream ss; // set_xxx_data ss << "void " << message_id << "_set_" << id() << "_data(" << message_id << "* message, const void* " << id() << ", int32_t " << id() << "_len) {" << std::endl; + ss << " assert(" << id() << " || " << id() << "_len == 0);" << std::endl; ss << " char* new_" << id() << " = (char*)malloc(" << id() << "_len + 1);" << std::endl; ss << " if (new_" << id() << " == NULL) { return; }" << std::endl; ss << " memcpy(new_" << id() << ", " << id() << ", " << id() << "_len);" << std::endl;