mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 03:02:36 +01:00
[NFC][AIX][XCOFF] fixed compile warning on the strncpy.
SUMMARY: There is warning when compile the file XCOFFObjectWriter.cpp /srv/llvm-buildbot-srcatch/llvm-build-dir/openmp-gcc-x86_64-linux-debian/llvm.src/llvm/lib/MC/XCOFFObjectWriter.cpp:414:17: warning: 'char* strncpy(char*, const char*, size_t)' specified bound 8 equals destination size [-Wstringop-truncation] The patch fixed the warning. Reviewer: daltenty Differential Revision: https://reviews.llvm.org/D71119
This commit is contained in:
parent
ac55c0eb6d
commit
8f5f4ed3e5
@ -416,7 +416,7 @@ void XCOFFObjectWriter::writeSymbolName(const StringRef &SymbolName) {
|
||||
W.write<int32_t>(0);
|
||||
W.write<uint32_t>(Strings.getOffset(SymbolName));
|
||||
} else {
|
||||
char Name[XCOFF::NameSize];
|
||||
char Name[XCOFF::NameSize+1];
|
||||
std::strncpy(Name, SymbolName.data(), XCOFF::NameSize);
|
||||
ArrayRef<char> NameRef(Name, XCOFF::NameSize);
|
||||
W.write(NameRef);
|
||||
|
Loading…
Reference in New Issue
Block a user