OpenBazaar/OpenBazaar — pull request #722 by sophron (2014-10-02 05:12:00+00:00)
Title: Introduced sanitizer callbacks in transport layer.

Currently, there is no sanitization of the incoming data. A malicious node or a bug in our side could end up with a message that crashes all connecting nodes. I believe issues #659 and #655 exist because of accepting unprepared data.

Please note that this PR does not sanitize the messages in the transport layer but it does the first step by introducing sanitizer callbacks that need filling. A sanitizer callback will be executed before the actual callback and its purpose is to make sure that the incoming messages are well-formatted (for example, the right keys exist, it is fixed-length, it contains valid data). Every callback should strictly come with a sanitizer.