set application buffer size to not exceed tls record size and handle buffer overflow condition.
Merge pull request #2915 from eminn/fix/ssl-maintenance

[backport] set application buffer size to not exceed tls record size and handle buf...