Modified version of a diff from Sebastien Marie to prevent a crash found with the afl fuzzer. Obtained from: OpenBSD (CVS Rev. 1.37) MFC after: 1 week