prevent buffer out of bounds corruption with very long filenames