--- openttd-0.5.2/gfx.c 2007-03-19 23:42:05.000000000 +0200 +++ openttd-0.5.2/gfx.c 2008-08-05 07:50:18.000000000 +0300 @@ -268,9 +268,11 @@ w += GetCharacterWidth(size, c); if (w >= maxw) { - // string got too big... insert dotdotdot - ddd_pos[0] = ddd_pos[1] = ddd_pos[2] = '.'; - ddd_pos[3] = '\0'; + /* string got too big... insert dotdotdot, but make sure we do not + * print anything beyond the string termination character. */ + int i; + for (i = 0; *ddd_pos != '\0' && i < 3; i++, ddd_pos++) *ddd_pos = '.'; + *ddd_pos = '\0'; return ddd_w; } } else {