added upload buffer overflow check, added max file check for downloads to avoid for infinite streams of data