elbart / node-memcache

node.js memcached client
285 stars 64 forks source link

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

Open windyrobin opened 12 years ago

windyrobin commented 12 years ago

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

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

dylancwood commented 10 years ago

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()