1. Pangolin provides raw uint8_t* and length function which is 100%-compatible with every other MQTT library, so your assertion is fundamentally incorrect and easily proven so simply by looking at the API
2. If you use the above , then like all other implmentations, no trailing \0 is stored - thats coding 101. So, if you then use a specific call which requires there to be a trailing zero (like every C string function) then of course it won't work! So don't do that - unpack the payload yourself using the correctly provded length, as in any other fully compatible implementation
3. If you call client.publish("mytopic",qos,retain,payload); where payload is eiter a std::string or a String then Pangolin appends a trailing \0 so that the payload can be used by any "normal" string function - including of course payloadToCstring. If this is not what you want then don't use it! use method 1 which works the same as any other MQTT implemntation.
4. Please , don't mix and match functions that were never intended to work together and then complain - wrongly - that they don't work and then "badmouth" the product - incorrectly - because you either didn't read or don't understand the documenation.