Fix some -Wstring-op-truncation warnings
authormcatanzaro@igalia.com <mcatanzaro@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 10 May 2018 21:46:52 +0000 (21:46 +0000)
committermcatanzaro@igalia.com <mcatanzaro@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 10 May 2018 21:46:52 +0000 (21:46 +0000)
commit10bf0eb67835b2429728a663428e728c13909871
treec038c20047749c787e46cca1d9e07d5763e263b3
parentcef7e89f082e08c01d2993b7b81030d1e73a23c8
Fix some -Wstring-op-truncation warnings
https://bugs.webkit.org/show_bug.cgi?id=185496

Reviewed by Alex Christensen.

Source/ThirdParty:

Disable this warning when building gtest.

* gtest/CMakeLists.txt:

Tools:

We have an off-by-one in the use of strncpy. The strings would not be null-terminated if
the input was too long. Ensure the buffers are zero-initialized so we don't need to manually
set the last bucket to NUL.

* TestWebKitAPI/Tests/WTF/AtomicString.cpp:
(TestWebKitAPI::testAtomicStringNumber):
* TestWebKitAPI/Tests/WTF/WTFString.cpp:
(TestWebKitAPI::testStringNumberFixedPrecision):
(TestWebKitAPI::testStringNumberFixedWidth):
(TestWebKitAPI::testStringNumber):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@231661 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/ThirdParty/ChangeLog
Source/ThirdParty/gtest/CMakeLists.txt
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WTF/AtomicString.cpp
Tools/TestWebKitAPI/Tests/WTF/WTFString.cpp