Content-Length: 226408 | pFad | http://github.com/naver/arcus-memcached/commit/5b08f7a000b44478fa4738fdeae534d656f35428

EB INTERNAL: consider maximum key length has increased in do_lqdetect_wr… · naver/arcus-memcached@5b08f7a · GitHub
Skip to content

Commit

Permalink
INTERNAL: consider maximum key length has increased in do_lqdetect_wr…
Browse files Browse the repository at this point in the history
…ite().
  • Loading branch information
SuhwanJang committed Nov 5, 2021
1 parent d2ca0eb commit 5b08f7a
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions lqdetect.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,14 @@ static void do_lqdetect_write(char client_ip[], char *key,
uint32_t offset = buffer->offset;
uint32_t nsaved = buffer->nsaved;
char *bufptr = buffer->data + buffer->offset;
uint32_t nwrite;
uint32_t length;
uint32_t nwrite, length, keylen = strlen(key);
char keybuf[251];

if (keylen > 250) { /* long key string */
keylen = snprintf(keybuf, sizeof(keybuf), "%.*s...%.*s", 124, key, 123, (key+(keylen - 123)));
} else { /* short key string */
keylen = snprintf(keybuf, sizeof(keybuf), key);
}

gettimeofday(&val, NULL);
ptm = localtime(&val.tv_sec);
Expand All @@ -143,11 +149,11 @@ static void do_lqdetect_write(char client_ip[], char *key,

nwrite = strlen(bufptr);
buffer->keypos[nsaved] = offset + nwrite;
buffer->keylen[nsaved] = strlen(key);
buffer->keylen[nsaved] = keylen;
length -= nwrite;
bufptr += nwrite;

snprintf(bufptr, length, "%s %s\n", key, arg->query);
snprintf(bufptr, length, "%s %s\n", keybuf, arg->query);
nwrite += strlen(bufptr);
buffer->offset += nwrite;
lqdetect.arg[cmd][nsaved] = *arg;
Expand Down

0 comments on commit 5b08f7a

Please sign in to comment.








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/naver/arcus-memcached/commit/5b08f7a000b44478fa4738fdeae534d656f35428

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy