Fixed a possible buffer overflow when the input filename is too long

Hi, please review and include this patch asap. Many greetings from Berlin, Bernard