Commit c6ad789e authored by Wez Furlong's avatar Wez Furlong Committed by Facebook Github Bot

folly: fix string truncation warning in LockFreeRingBufferTest

Summary:
```
folly/experimental/test/LockFreeRingBufferTest.cpp:279:14: error
: ‘char* strncpy(char*, const char*, size_t)’ output may be truncated copying 1023 bytes from a string of length 1023 [-Werror=stringop-truncation]
       strncpy(data_, data.data_, sizeof(data_) - 1);
       ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```

Reviewed By: yfeldblum

Differential Revision: D14702561

fbshipit-source-id: 8f85c758c7afc99eeb1f95920511fb4195eafbbe
parent ab0aeeea
......@@ -276,8 +276,10 @@ TEST(LockFreeRingBuffer, writeReadDifferentType) {
}
StringBuffer& operator=(FixedBuffer& data) {
strncpy(data_, data.data_, sizeof(data_) - 1);
static_assert(
sizeof(data_) == sizeof(data.data_),
"FixedBuffer::data_ size must match StringBuffer::data_");
memcpy(data_, data.data_, sizeof(data.data_));
return (*this);
}
};
......
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