Skip to content

Commit

Permalink
Fix dual channel replid null termination bug
Browse files Browse the repository at this point in the history
Signed-off-by: Jacob Murphy <[email protected]>
  • Loading branch information
murphyjacob4 committed Nov 7, 2024
1 parent 1c18c80 commit 5ea9b52
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/replication.c
Original file line number Diff line number Diff line change
Expand Up @@ -2698,6 +2698,7 @@ static int dualChannelReplHandleEndOffsetResponse(connection *conn, sds *err) {
/* Initiate repl_provisional_primary to act as this replica temp primary until RDB is loaded */
server.repl_provisional_primary.conn = server.repl_transfer_s;
memcpy(server.repl_provisional_primary.replid, primary_replid, CONFIG_RUN_ID_SIZE);
server.repl_provisional_primary.replid[CONFIG_RUN_ID_SIZE] = '\0';
server.repl_provisional_primary.reploff = reploffset;
server.repl_provisional_primary.read_reploff = reploffset;
server.repl_provisional_primary.dbid = dbid;
Expand Down Expand Up @@ -4270,6 +4271,7 @@ void replicationResurrectProvisionalPrimary(void) {
* drain. */
replicationCreatePrimaryClientWithHandler(server.repl_transfer_s, server.repl_provisional_primary.dbid, NULL);
memcpy(server.primary->replid, server.repl_provisional_primary.replid, CONFIG_RUN_ID_SIZE);
server.primary->replid[CONFIG_RUN_ID_SIZE] = '\0';
server.primary->reploff = server.repl_provisional_primary.reploff;
server.primary->read_reploff = server.repl_provisional_primary.read_reploff;
server.primary_repl_offset = server.primary->reploff;
Expand Down

0 comments on commit 5ea9b52

Please sign in to comment.