fixed mysql_format buffer overflow bugs