llvm.org GIT mirror llvm / 8080935
[MetadataTest] Fix off-by-one strncpy warning reported by gcc8. (NFC) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347528 91177308-0d34-0410-b5e6-96231b3b80d8 Florian Hahn 11 months ago
1 changed file(s) with 3 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
146146
147147 // Test that MDString prints out the string we fed it.
148148 TEST_F(MDStringTest, PrintingSimple) {
149 char *str = new char[13];
150 strncpy(str, "testing 1 2 3", 13);
151 MDString *s = MDString::get(Context, StringRef(str, 13));
152 strncpy(str, "aaaaaaaaaaaaa", 13);
153 delete[] str;
149 char str[14] = "testing 1 2 3";
150 MDString *s = MDString::get(Context, StringRef(&str[0], 13));
151 strncpy(str, "aaaaaaaaaaaaa", 14);
154152
155153 std::string Str;
156154 raw_string_ostream oss(Str);