summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2013-12-09 13:28:39 +0100
committerantirez <antirez@gmail.com>2013-12-10 15:40:33 +0100
commit8d0083ba250fead6a425a08246744e4b796d49fb (patch)
tree649b365527958cf10a20205b536e241887a54ec8
parentfba0b23e724e86ef6b98f07594cec3b45b8a9ab9 (diff)
downloadredis-8d0083ba250fead6a425a08246744e4b796d49fb.tar.gz
Handle inline requested terminated with just \n.
-rw-r--r--src/networking.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/networking.c b/src/networking.c
index c77ff5dbd..ac3c2f0b9 100644
--- a/src/networking.c
+++ b/src/networking.c
@@ -842,11 +842,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) {
@@ -856,6 +859,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);