Fixing 2 security issues

This 'fresh' pull request will fix two previously reported issues:
* "Fix multiple stack-based buffer overflows in file transfer feature"
* "Make sure that no integer overflow could occur during scaling"

... without being cluttered by undesirable comments/commits. Enjoy!