Browse Source

Search for EOL with bkey message to avoid false positives

master
Con Kolivas 9 years ago
parent
commit
55ea835f7a
  1. 2
      src/ckpool.c
  2. 4
      src/connector.c

2
src/ckpool.c

@ -759,7 +759,7 @@ int read_socket_line(connsock_t *cs, float *timeout)
} }
ret = eom - cs->buf; ret = eom - cs->buf;
if (unlikely(ret > 5) && (bkey = strstr(cs->buf + ret - 5, "bkey"))) { if (unlikely(ret > 5 && (bkey = strstr(cs->buf + ret - 5, "bkey\n")))) {
eom = bkey_eom(ckp, cs, bkey, timeout); eom = bkey_eom(ckp, cs, bkey, timeout);
ret = eom - cs->buf; ret = eom - cs->buf;
} else } else

4
src/connector.c

@ -926,7 +926,7 @@ static void send_client(cdata_t *cdata, const int64_t id, char *buf, int slen, i
} }
if (unlikely(len > slen)) { if (unlikely(len > slen)) {
bkey = strstr(buf + slen - 4 - 1, "bkey"); bkey = strstr(buf + slen - 5, "bkey\n");
if (bkey) if (bkey)
blen = len - (bkey - buf); blen = len - (bkey - buf);
} }
@ -1249,7 +1249,7 @@ static void process_client_msg(cdata_t *cdata, char *buf, uint32_t msglen)
slen = strlen(buf); slen = strlen(buf);
if (likely(slen > 5)) { if (likely(slen > 5)) {
bkey = strstr(buf + slen - 5, "bkey"); bkey = strstr(buf + slen - 5, "bkey\n");
if (bkey) { if (bkey) {
LOGDEBUG("Bkey found in process_client_msg"); LOGDEBUG("Bkey found in process_client_msg");
blen = msglen - (bkey - buf); blen = msglen - (bkey - buf);

Loading…
Cancel
Save