MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / checkStringLength

Function checkStringLength

src/t_string.cpp:41–53  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39 *----------------------------------------------------------------------------*/
40
41static int checkStringLength(client *c, long long size, long long append) {
42 if (c->flags & CLIENT_MASTER)
43 return C_OK;
44 /* 'uint64_t' cast is there just to prevent undefined behavior on overflow */
45 long long total = (uint64_t)size + append;
46 /* Test configured max-bulk-len represending a limit of the biggest string object,
47 * and also test for overflow. */
48 if (total > g_pserver->proto_max_bulk_len || total < size || total < append) {
49 addReplyError(c,"string exceeds maximum allowed size (proto-max-bulk-len)");
50 return C_ERR;
51 }
52 return C_OK;
53}
54
55/* The setGenericCommand() function implements the SET operation with different
56 * options and variants. This function is called in order to implement the

Callers 2

setrangeCommandFunction · 0.85
appendCommandFunction · 0.85

Calls 1

addReplyErrorFunction · 0.85

Tested by

no test coverage detected