Extra data are added in the end of unziped files


I found this when having zip-files sent to me and downloaded and unziped by DownloadMailTask. There are spaces (an maybe other characters) added in the end of the unziped file. After examing the source i found that then MemoryStream of the unziped file are written to disk the buffer will be read beond the length of the buffer (the full capacity).
I have fixed this by changing
fileStream.Write(current.Value.GetBuffer(), 0, current.Value.Capacity);
fileStream.Write(current.Value.GetBuffer(), 0, (int)current.Value.Length);
in the Receive() method of the MailDataReceiver class.
The long to int cast might impact the size of files able to be saved.

file attachments