Added robustness check for file downloads that are too large. Also added buffer overflow check for filenames that are too long