Fix possible buffer overflow problem in chkNum of scanner.