Replace snprintf by strncpy (fix compiler warning)

Signed-off-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
Stefan Weil 2021-01-08 19:01:26 +01:00
parent 209c1df599
commit e46141ac99

View File

@ -47,7 +47,7 @@ TEST(InputBufferTest, Read) {
const int kMaxBufSize = 128;
char buffer[kMaxBufSize];
auto s = "Hello\n world!";
snprintf(buffer, kMaxBufSize, s);
strncpy(buffer, s, kMaxBufSize);
EXPECT_STREQ(s, buffer);
FILE* fp = tmpfile();
CHECK(fp != nullptr);