CollectionFactory icon indicating copy to clipboard operation
CollectionFactory copied to clipboard

Passing a single "\r\n" pair crashes the socket

Open PusherLabs opened this issue 6 years ago • 1 comments

https://github.com/elliotchance/CollectionFactory/blob/d146492e71177e981d94c20d03692ee40e6780dd/CollectionFactory/CollectionFactory.m#L11

When NOT using CRLF as a readDelimiter, passing a single "\r\n" pair to the socket passes this test (i.e. != nil and .length == 2), but then gets trimmed off at L16/L17, resulting in an empty string @L17, resulting in an empty array @L22, causing L36 to fault.

FIX: whitespace should be trimmed (i.e. L16/L17) BEFORE this sanity check at L11.

PusherLabs avatar Mar 27 '18 17:03 PusherLabs

Thanks @PusherLabs, would you be able to put in a PR for this fix?

elliotchance avatar Mar 28 '18 04:03 elliotchance