diff --git a/src/xpdev/sockwrap.c b/src/xpdev/sockwrap.c
index 228851b872c1c981e241a39b031495de33acf9ed..5cf7832c87602bc1c793a5e24f28c8ff12467f00 100644
--- a/src/xpdev/sockwrap.c
+++ b/src/xpdev/sockwrap.c
@@ -513,6 +513,7 @@ DLLEXPORT const char* socket_strerror(int error_number)
 		msg,
 		sizeof(msg),
 		NULL);
+	truncsp(msg);
 	return msg;
 }
 #endif