diff --git a/src/d_clisrv.c b/src/d_clisrv.c
index 8783fb365b8ee7221a35082b293d56ee312dcd24..46f8a9a10533df590ab852d45c9d2559a7e17f35 100644
--- a/src/d_clisrv.c
+++ b/src/d_clisrv.c
@@ -1177,9 +1177,7 @@ static inline void CL_DrawConnectionStatus(void)
 				size_t endhalfpos = strlen(filename)-12;
 				// display as first 16 chars + ... + last 12 chars
 				// which should add up to 31 if our math(s) is correct
-				strncpy(tempname, filename, 16);
-				strncpy(tempname+16, "...", 3);
-				strncpy(tempname+16+3, filename+endhalfpos, 12);
+				snprintf(tempname, 31, "%.16s...%.12s", filename, filename+endhalfpos);
 			}
 			else // we can copy the whole thing in safely
 			{