Skip to content

Commit

Permalink
Fix cluster human_nodename Getter data loss in nodes.conf (#12325)
Browse files Browse the repository at this point in the history
auxHumanNodenameGetter limited to %.40s, since we did not limit the
length of config cluster-announce-human-nodename, %.40s will cause
nodename data loss (we will persist it in nodes.conf).

Additional modified auxHumanNodenamePresent to use sdslen.
  • Loading branch information
enjoy-binbin authored Jun 20, 2023
1 parent b510624 commit cd4f3e2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/cluster.c
Original file line number Diff line number Diff line change
Expand Up @@ -240,11 +240,11 @@ int auxHumanNodenameSetter(clusterNode *n, void *value, int length) {
}

sds auxHumanNodenameGetter(clusterNode *n, sds s) {
return sdscatprintf(s, "%.40s", n->human_nodename);
return sdscatprintf(s, "%s", n->human_nodename);
}

int auxHumanNodenamePresent(clusterNode *n) {
return strlen(n->human_nodename);
return sdslen(n->human_nodename);
}

/* clusterLink send queue blocks */
Expand Down

0 comments on commit cd4f3e2

Please sign in to comment.