Commit d5fbef09 authored by Marcin Siodelski's avatar Marcin Siodelski
Browse files

[5340] Fixed invalid use of Pkt4::setFile and Pkt4::setSname functions.

parent 0d05123d
......@@ -401,14 +401,16 @@ Dhcpv4Exchange::setReservedMessageFields() {
resp_->setSiaddr(host->getNextServer());
}
if (!host->getServerHostname().empty()) {
resp_->setSname(reinterpret_cast<
const uint8_t*>(host->getServerHostname().c_str()));
std::string sname = host->getServerHostname();
if (!sname.empty()) {
resp_->setSname(reinterpret_cast<const uint8_t*>(sname.c_str()),
sname.size());
}
if (!host->getBootFileName().empty()) {
resp_->setFile(reinterpret_cast<
const uint8_t*>(host->getBootFileName().c_str()));
std::string bootfile = host->getBootFileName();
if (!bootfile.empty()) {
resp_->setFile(reinterpret_cast<const uint8_t*>(bootfile.c_str()),
bootfile.size());
}
}
}
......
......@@ -269,7 +269,7 @@ public:
///
/// @param sname value to be set
/// @param sname_len length of the sname buffer (up to MAX_SNAME_LEN)
void setSname(const uint8_t* sname, size_t sname_len = MAX_SNAME_LEN);
void setSname(const uint8_t* sname, size_t sname_len);
/// @brief Returns file field
///
......@@ -285,7 +285,7 @@ public:
/// @param file value to be set
/// @param file_len length of the file buffer (up to MAX_FILE_LEN)
void
setFile(const uint8_t* file, size_t file_len = MAX_FILE_LEN);
setFile(const uint8_t* file, size_t file_len);
/// @brief Sets hardware address.
///
......
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