setWindowTitleFormat: fix buffer overrun