Fix #46 Can crash iOS side with "absurd length"
Fix #46 Can crash iOS side with "absurd length"

We scan through a buffer looking for a \0 terminator and if not found
we account for how many bytes we've scanned, make a new buffer and
continue accumulating from the stream. The defect here is that if we
fail to see a \0, this doesn't mean we've scanned through BUFFER_SIZE
bytes; we've scanned `len` bytes.

This bug needs a sizable amount of TCP traffic coming across the wire
so that we get less than BUFFER_SIZE bytes sometimes, thus provoking
the failure.

jobez/ambly,omcljs/ambly,domesticmouse/ambly,jobez/ambly,domesticmouse/ambly,bsvingen/ambly,omcljs/ambly,bsvingen/ambly