bug-22061: Clean up dangerous usage of c_str()