2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-28 12:37:55 +00:00

[#3770] Revert length changes in mysql host code

modified:   src/hooks/dhcp/mysql/mysql_host_data_source.cc
This commit is contained in:
Thomas Markwalder 2025-07-21 14:44:25 -04:00
parent 7fdb2bd420
commit 084238451e

View File

@ -619,7 +619,7 @@ public:
// Convert user_context to string as well. // Convert user_context to string as well.
std::string user_context; std::string user_context;
if (user_context_null_ == MLM_FALSE) { if (user_context_null_ == MLM_FALSE) {
user_context_[user_context_length_ - 1] = '\0'; user_context_[user_context_length_] = '\0';
user_context.assign(user_context_); user_context.assign(user_context_);
} }
@ -949,7 +949,7 @@ private:
if (space_null_ == MLM_FALSE) { if (space_null_ == MLM_FALSE) {
// Typically, the string values returned by the database are not // Typically, the string values returned by the database are not
// NULL terminated. // NULL terminated.
space_[space_length_ - 1] = '\0'; space_[space_length_] = '\0';
space.assign(space_); space.assign(space_);
} }
@ -962,21 +962,21 @@ private:
// Convert formatted_value to string. // Convert formatted_value to string.
std::string formatted_value; std::string formatted_value;
if (formatted_value_null_ == MLM_FALSE) { if (formatted_value_null_ == MLM_FALSE) {
formatted_value_[formatted_value_length_ - 1] = '\0'; formatted_value_[formatted_value_length_] = '\0';
formatted_value.assign(formatted_value_); formatted_value.assign(formatted_value_);
} }
// Convert user_context to string. // Convert user_context to string.
std::string user_context; std::string user_context;
if (user_context_null_ == MLM_FALSE) { if (user_context_null_ == MLM_FALSE) {
user_context_[user_context_length_ - 1] = '\0'; user_context_[user_context_length_] = '\0';
user_context.assign(user_context_); user_context.assign(user_context_);
} }
// Convert client classes to string. // Convert client classes to string.
std::string client_classes; std::string client_classes;
if (client_classes_null_ == MLM_FALSE) { if (client_classes_null_ == MLM_FALSE) {
client_classes_[client_classes_length_ - 1] = '\0'; client_classes_[client_classes_length_] = '\0';
client_classes.assign(client_classes_); client_classes.assign(client_classes_);
} }