Checks for buffer out of bounds before writing to the stream. Fixes #636
Merge pull request #651 from xetorthio/protocol_bound_fix

Checks for buffer out of bounds before writing to the stream. Fixes #636