Fixed out-of-bounds read errors in ssl3_get_key_exchange.

Largely based on OpenSSL commit 0ed8e95c.