(Pre-existing) The buffer sizes here should be CF_BUFSIZE, without the -1, assuming filename is actually declared with size CF_BUFSIZE.