--- tclWinInit.c-orig	2006-03-31 14:06:52.101575600 +0100
+++ tclWinInit.c	2006-03-31 14:21:51.364726100 +0100
@@ -470,6 +470,11 @@
     Tcl_DString *bufPtr)
 {
     Tcl_DStringInit(bufPtr);
+    /* Ensure the DString's buffer is large enough. */
+#   define MIN_DSTRING_LEN (2 * (3 + TCL_INTEGER_SPACE))
+#   if TCL_DSTRING_STATIC_SIZE < MIN_DSTRING_LEN
+      Tcl_DStringSetLength(bufPtr, MIN_DSTRING_LEN);
+#   endif
     wsprintfA(Tcl_DStringValue(bufPtr), "cp%d", GetACP());
     return Tcl_DStringValue(bufPtr);
 }
