Fix UB.
This commit is contained in:
parent
34712da2e7
commit
89a8aaf502
@ -268,9 +268,10 @@ TEST(UtilTest, StrError) {
|
|||||||
EXPECT_STREQ("", message);
|
EXPECT_STREQ("", message);
|
||||||
result = StrError(error_code, message = buffer, BUFFER_SIZE);
|
result = StrError(error_code, message = buffer, BUFFER_SIZE);
|
||||||
EXPECT_EQ(0, result);
|
EXPECT_EQ(0, result);
|
||||||
EXPECT_GE(BUFFER_SIZE - 1u, std::strlen(message));
|
std::size_t message_size = std::strlen(message);
|
||||||
|
EXPECT_GE(BUFFER_SIZE - 1u, message_size);
|
||||||
EXPECT_STREQ(strerror(error_code), message);
|
EXPECT_STREQ(strerror(error_code), message);
|
||||||
result = StrError(error_code, message = buffer, std::strlen(message));
|
result = StrError(error_code, message = buffer, message_size);
|
||||||
EXPECT_EQ(ERANGE, result);
|
EXPECT_EQ(ERANGE, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user