Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
driver/toobj.cpp: writeModule: don't use StringRef::data to get a c_s…
…tr (#4554) The .data() method on a StringRef, returns a const char* to the first character but there is no guarantee that the string is null terminated. In order to get a proper null terminated string it is necessary to use .str() which will return a C++ std::string which provided the .c_str() method to get the null terminated C string. The invalid behavior can be seen by running (where the user doesn't have acces to the inaccessible folder): $ ldc2 <<< '' - -od=inaccessible/impossible Error: failed to create output directory: inaccessible/impossible/__stdin_4416.o The error message should only include inaccessible/impossible. Signed-off-by: Andrei Horodniceanu <[email protected]>
- Loading branch information