Skip to content

Commit

Permalink
Fix ULong config boundary checking
Browse files Browse the repository at this point in the history
Signed-off-by: Brennan Cathcart <[email protected]>
  • Loading branch information
BCathcart committed Jul 2, 2024
1 parent a4ce40b commit 0a613f0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/cluster_legacy.c
Original file line number Diff line number Diff line change
Expand Up @@ -1780,7 +1780,7 @@ void clusterHandleConfigEpochCollision(clusterNode *sender) {
* that even if we receive gossip messages from other nodes that still remember
* about the node we want to remove, we don't re-add it before some time.
*
* The default blacklist ttl is set to 1 minute which means
* The default blacklist ttl is 1 minute which means
* that valkey-cli has 60 seconds to send CLUSTER FORGET messages to nodes
* in the cluster without dealing with the problem of other nodes re-adding
* back the node to nodes we already sent the FORGET command to.
Expand Down
7 changes: 4 additions & 3 deletions src/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -2051,6 +2051,7 @@ static void numericConfigInit(standardConfig *config) {

static int numericBoundaryCheck(standardConfig *config, long long ll, const char **err) {
if (config->data.numeric.numeric_type == NUMERIC_TYPE_ULONG_LONG ||
config->data.numeric.numeric_type == NUMERIC_TYPE_ULONG ||
config->data.numeric.numeric_type == NUMERIC_TYPE_UINT ||
config->data.numeric.numeric_type == NUMERIC_TYPE_SIZE_T) {
/* Boundary check for unsigned types */
Expand Down Expand Up @@ -3170,9 +3171,9 @@ standardConfig static_configs[] = {
#endif

/* Unsigned Long configs */
createULongConfig("active-defrag-max-scan-fields", NULL, MODIFIABLE_CONFIG, 1, LONG_MAX, server.active_defrag_max_scan_fields, 1000, INTEGER_CONFIG, NULL, NULL), /* Default: keys with more than 1000 fields will be processed separately */
createULongConfig("slowlog-max-len", NULL, MODIFIABLE_CONFIG, 0, LONG_MAX, server.slowlog_max_len, 128, INTEGER_CONFIG, NULL, NULL),
createULongConfig("acllog-max-len", NULL, MODIFIABLE_CONFIG, 0, LONG_MAX, server.acllog_max_len, 128, INTEGER_CONFIG, NULL, NULL),
createULongConfig("active-defrag-max-scan-fields", NULL, MODIFIABLE_CONFIG, 1, ULONG_MAX, server.active_defrag_max_scan_fields, 1000, INTEGER_CONFIG, NULL, NULL), /* Default: keys with more than 1000 fields will be processed separately */
createULongConfig("slowlog-max-len", NULL, MODIFIABLE_CONFIG, 0, ULONG_MAX, server.slowlog_max_len, 128, INTEGER_CONFIG, NULL, NULL),
createULongConfig("acllog-max-len", NULL, MODIFIABLE_CONFIG, 0, ULONG_MAX, server.acllog_max_len, 128, INTEGER_CONFIG, NULL, NULL),
createULongConfig("cluster-blacklist-ttl", NULL, MODIFIABLE_CONFIG, 0, ULONG_MAX, server.cluster_blacklist_ttl, 60, INTEGER_CONFIG, NULL, NULL),

/* Long Long configs */
Expand Down

0 comments on commit 0a613f0

Please sign in to comment.