Repository: valkey-io/valkey
File: src/replication.c (C)

Code before:
            argv[argc] = "capa";
            lens[argc] = strlen("capa");
            argc++;
            argv[argc] = REPLICA_CAPA_SKIP_RDB_CHECKSUM_STR;
            lens[argc] = strlen(REPLICA_CAPA_SKIP_RDB_CHECKSUM_STR);
            argc++;
        }
        if (server.dual_channel_replication) {
            argv[argc] = "capa";
            lens[argc] = strlen("capa");
            argc++;
            argv[argc] = "dual-channel";
            lens[argc] = strlen("dual-channel");
            argc++;
        }
        err = sendCommandArgv(conn, argc, argv, lens);
        if (err) goto write_error;

        /* Inform the primary of our (replica) version. */
        err = sendCommand(conn, "REPLCONF", "version", VALKEY_VERSION, NULL);
        if (err) goto write_error;

        /* Inform the primary of our (replica) node name. */
        if (server.cluster_enabled) {
            char *argv[] = {"REPLCONF", "SET-CLUSTER-NODE-ID", server.cluster->myself->name};
            size_t lens[] = {8, 19, CLUSTER_NAMELEN};
            err = sendCommandArgv(conn, 3, argv, lens);
            if (err) goto write_error;
        }

        server.repl_state = REPL_STATE_RECEIVE_AUTH_REPLY;
        return;
    }

    if (server.repl_state == REPL_STATE_RECEIVE_AUTH_REPLY && !server.primary_auth)
        server.repl_state = REPL_STATE_RECEIVE_PORT_REPLY;

    /* Receive AUTH reply. */
    if (server.repl_state == REPL_STATE_RECEIVE_AUTH_REPLY) {
        err = receiveSynchronousResponse(conn);
        if (err == NULL) goto no_response_error;
        if (err[0] == '-') {
            serverLog(LL_WARNING, "Unable to AUTH to PRIMARY: %s", err);
            sdsfree(err);
            goto error;
        }
        sdsfree(err);
        err = NULL;
        server.repl_state = REPL_STATE_RECEIVE_PORT_REPLY;
        return;
    }

Review comment (suggestion):
```suggestion
            size_t lens[] = {strlen(argv[0]), strlen(argv[1]), CLUSTER_NAMELEN};
```            

Code after:
            argc++;
        }
        if (server.dual_channel_replication) {
            argv[argc] = "capa";
            lens[argc] = strlen("capa");
            argc++;
            argv[argc] = "dual-channel";
            lens[argc] = strlen("dual-channel");
            argc++;
        }
        err = sendCommandArgv(conn, argc, argv, lens);
        if (err) goto write_error;

        /* Inform the primary of our (replica) version. */
        err = sendCommand(conn, "REPLCONF", "version", VALKEY_VERSION, NULL);
        if (err) goto write_error;

        /* Inform the primary of our (replica) node name. */
        if (server.cluster_enabled) {
            char *argv[] = {"REPLCONF", "SET-CLUSTER-NODE-ID", server.cluster->myself->name};
            size_t lens[] = {strlen(argv[0]), strlen(argv[1]), CLUSTER_NAMELEN};
            err = sendCommandArgv(conn, 3, argv, lens);
            if (err) goto write_error;
        }

        server.repl_state = REPL_STATE_RECEIVE_AUTH_REPLY;
        return;
    }

    if (server.repl_state == REPL_STATE_RECEIVE_AUTH_REPLY && !server.primary_auth)
        server.repl_state = REPL_STATE_RECEIVE_PORT_REPLY;

    /* Receive AUTH reply. */
    if (server.repl_state == REPL_STATE_RECEIVE_AUTH_REPLY) {
        err = receiveSynchronousResponse(conn);
        if (err == NULL) goto no_response_error;
        if (err[0] == '-') {
            serverLog(LL_WARNING, "Unable to AUTH to PRIMARY: %s", err);
            sdsfree(err);
            goto error;
        }
        sdsfree(err);
        err = NULL;
        server.repl_state = REPL_STATE_RECEIVE_PORT_REPLY;
        return;
    }

    /* Receive REPLCONF listening-port reply. */
    if (server.repl_state == REPL_STATE_RECEIVE_PORT_REPLY) {
        err = receiveSynchronousResponse(conn);
        if (err == NULL) goto no_response_error;