Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโ€™ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: Fix node_name buffer size #798

Merged
merged 1 commit into from
Nov 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cluster_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,15 +132,15 @@ static int compare_cont_item(const void *t1, const void *t2)

static int gen_node_continuum(struct cont_item *continuum, const char *node_name)
{
char buffer[MAX_NODE_NAME_LENGTH+1] = "";
char buffer[MAX_NODE_NAME_LENGTH+4] = "";
int length;
unsigned int hh, nn, pp;
unsigned char digest[16];
int duplicate = 0;

pp = 0;
for (hh=0; hh<NUM_OF_HASHES; hh++) {
length = snprintf(buffer, MAX_NODE_NAME_LENGTH, "%s-%u", node_name, hh);
length = snprintf(buffer, sizeof(buffer), "%s-%u", node_name, hh);
hash_md5(buffer, length, digest);
for (nn=0; nn<NUM_PER_HASH; nn++, pp++) {
continuum[pp].hpoint = ((uint32_t) (digest[3 + nn * NUM_PER_HASH] & 0xFF) << 24)
Expand Down
Loading