node-memcache icon indicating copy to clipboard operation
node-memcache copied to clipboard

should use 'END' + CRLF instead of 'END'

Open windyrobin opened this issue 14 years ago • 1 comments

for codes like: buffer.indexOf('END')

if the data contains string like '*END' ,it will crash

windyrobin avatar Feb 02 '12 10:02 windyrobin

I agree (mostly). I ran into this issue today when using this awesome module to read PHP sessions from a memcached server. If the session-string has a value containing the string "END" in it, then the session-string will be truncated, and nothing after the 'E' in 'END' will be passed to the callback. Instead of just looking for "END" or "END" + crlf' it might be best to look for the last occurrence of 'crlf + "END" + crlf inside of handle_get()

dylancwood avatar Jan 24 '14 23:01 dylancwood