silence -Wstring-truncation for correct use of strncpy (#5146)
- ensuring header is zerod
This commit is contained in:
parent
91c1d5aa63
commit
c09c4ba374
|
@ -43,10 +43,13 @@ void LogField::writeHeader(Writer& outBuffer) const {
|
|||
buffer[54] = m_digits;
|
||||
|
||||
// Offset 55, (optional) category string
|
||||
memset(&buffer[55], 0, 34);
|
||||
if (m_category) {
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wstringop-truncation"
|
||||
// strncpy's exclusion of null terminator is correct and appropriate behavior for this field
|
||||
strncpy(&buffer[55], m_category, 34);
|
||||
} else {
|
||||
memset(&buffer[55], 0, 34);
|
||||
#pragma GCC diagnostic pop
|
||||
}
|
||||
|
||||
// Total size = 89
|
||||
|
|
Loading…
Reference in New Issue