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

...fer overflow condition.