Qt4: fix buffer overflow