From eaf1bfb88bdd6e7f4f4a7015280572cc234088c4 Mon Sep 17 00:00:00 2001
From: antirez <antirez@gmail.com>
Date: Mon, 9 Dec 2013 13:28:39 +0100
Subject: [PATCH] Handle inline requested terminated with just \n.

---
 src/networking.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/networking.c b/src/networking.c
index 2af8915a2..e8283c272 100644
--- a/src/networking.c
+++ b/src/networking.c
@@ -865,11 +865,14 @@ void resetClient(redisClient *c) {
 }
 
 int processInlineBuffer(redisClient *c) {
-    char *newline = strstr(c->querybuf,"\r\n");
+    char *newline;
     int argc, j;
     sds *argv, aux;
     size_t querylen;
 
+    /* Search for end of line */
+    newline = strchr(c->querybuf,'\n');
+
     /* Nothing to do without a \r\n */
     if (newline == NULL) {
         if (sdslen(c->querybuf) > REDIS_INLINE_MAX_SIZE) {
@@ -879,6 +882,10 @@ int processInlineBuffer(redisClient *c) {
         return REDIS_ERR;
     }
 
+    /* Handle the \r\n case. */
+    if (newline && newline != c->querybuf && *(newline-1) == '\r')
+        newline--;
+
     /* Split the input buffer up to the \r\n */
     querylen = newline-(c->querybuf);
     aux = sdsnewlen(c->querybuf,querylen);