diff --git a/common/exception/XrootCl.cpp b/common/exception/XrootCl.cpp
index fc7b52f9457a5ffdb7175f0291ee33d29bcb191e..fee2dc008a7e37db331a12812345118c4f15d7f6 100644
--- a/common/exception/XrootCl.cpp
+++ b/common/exception/XrootCl.cpp
@@ -34,7 +34,9 @@ XrootCl::XrootCl(const XrdCl::XRootDStatus& status, const std::string & what) {
   w << status.ToStr() << " code:" << status.code 
     << " errNo:" << status.errNo 
     << " status:" << status.status;
-  getMessage().str(w.str());
+  std::string x(w.str());
+  x.resize(x.find_first_of('\0'));
+  getMessage().str(x);
 }
 
 void XrootCl::throwOnError(const XrdCl::XRootDStatus& status, std::string context)