mirror of
https://github.com/ashaduri/gsmartcontrol.git
synced 2026-09-26 13:55:34 +00:00
hz/intrusive_ptr.h: strncpy() string terminators
When building the error message, ensure each strncpy() includes the null byte terminating the copied string, even though the first two will be immediately overwritten by the next part. Silences compiler warnings.
This commit is contained in:
@@ -100,8 +100,8 @@ struct intrusive_ptr_error : virtual public std::exception { // from <exception
|
||||
std::size_t tmsg_len = std::strlen(tmsg);
|
||||
std::size_t tname_len = std::strlen(tname);
|
||||
msg_ = new char[msg_len + tmsg_len + tname_len + 1];
|
||||
std::strncpy(msg_, msg, msg_len);
|
||||
std::strncpy(msg_ + msg_len, tmsg, tmsg_len);
|
||||
std::strncpy(msg_, msg, msg_len + 1);
|
||||
std::strncpy(msg_ + msg_len, tmsg, tmsg_len + 1);
|
||||
std::strncpy(msg_ + msg_len + tmsg_len, tname, tname_len + 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user