rapid7/metasploit-framework — pull request #4338 by FireFart (2014-12-08 21:04:48+00:00)
Title: fix heartbleed cert parsing, fix #4309

This fixes the hearbleed certificate parsing bug #4309

Basically it was all about `get_once` did not get all data, so I switched to `get`. But @hmoore-r7 changed them once in this commit: https://github.com/rapid7/metasploit-framework/commit/5e900a9f495c8a99b0b418c3c4b580ed6069afed so maybe he can have a look at it.

Before fix:
```
[!]	Certificates length: 4124
[!]	Data length: 2745
```

After Fix:
```
[!]	Certificates length: 4124
[!]	Data length: 4127
```

Data length is the complete handshake data length passed into the function. As you can see, the length field from the ssl record is bigger than the data received, so there is not enough data. After the fix, the length is correct (diff is 3 bytes for the length field).

cc @wchen-r7 @todb-r7