The std::string class can return a null-terminated string for you. This is guaranteed to work (no memory allocation). You can test the string for emptiness in various ways. The string class stores the length.
You are basically criticizing C and blaming this on C++, as you are talking about C interfaces. You have to feed those interfaces the same way from Pascal; no difference there.
Since C++17, there's also the std::string_view class, which is a "low cost" wrapper to keep arrays safe, even C strings.
Again, you can do things wrong if you want, but only if you ignore all advises.