[Lldb-commits] [PATCH] D44042: Ensure that trailing characters aren't included in PECOFF section names

Greg Clayton via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Mar 2 14:30:15 PST 2018


clayborg requested changes to this revision.
clayborg added inline comments.
This revision now requires changes to proceed.


================
Comment at: source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp:511
+  // necessarily null-terminated
+  sect_name = std::string(sect.name, sizeof(sect.name));
   return true;
----------------
This is storing any extra NULL characters in sect_name. Might be better to do:

```
sect_name = std::string(sect.name, strnlen(sect.name, sizeof(sect.name)));
```


https://reviews.llvm.org/D44042





More information about the lldb-commits mailing list