Added two buffer overflow protections. Changed strlen to strnlen.

I added one task_free() for parent process during download. You had
already taken care of the parent in the uploads.