Why segmentation fault?
#include <arpa/inet.h>
#include <netinet/in.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
#include <unistd.h>

#include "helper.c"

#ifndef PORT
#define PORT 53655
#endif
#define MAX_BACKLOG 5
#define MAX_CONNECTIONS 12
#define BUF_SIZE 128

typedef struct client {
    int client_fd;
    char *client_username;
    char partial_read[BUF_SIZE];
    struct client *next;
} Client;

int accept_connection(int fd, Client *client_linked_list) {
    int client_fd = accept(fd, NULL, NULL);
    if (client_fd < 0) {
        perror("server: accept");
        close(fd);
        exit(1);
    }

    Client *curr_node = client_linked_list;
    if (curr_node == NULL) {
        client_linked_list = malloc(sizeof(Client));
        client_linked_list->client_fd = client_fd;
        client_linked_list->client_username = NULL;
    } else {
        while (curr_node->next != NULL) {
            if (curr_node->next->client_fd != -1) {
                break;
            }
            curr_node = curr_node->next;
        }
        Client *new_node = malloc(sizeof(Client));
        new_node->client_fd = client_fd;
        new_node->client_username = NULL;
        curr_node->next = new_node;
    }
    return client_fd;
}

if (FD_ISSET(sock_fd, &listen_fds)) {
    int client_fd = accept_connection(sock_fd, client_linked_list);
    if (client_fd > max_fd) {
        max_fd = client_fd;
    }
    FD_SET(client_fd, &all_fds);
    printf("Accepted connection\n");

    write(client_fd, "Please enter a username: ", 26);
    char buf[BUF_SIZE + 1];
    int num_read = read(client_fd, &buf, BUF_SIZE);
    buf[num_read] = '\0';
    printf("1\n");
    Client *curr_client = client_linked_list;
    while (curr_client->client_fd != client_fd) {
        curr_client = curr_client->next;
    }
    printf("2\n");
    if (curr_client->client_username == NULL) {
        printf("3\n");
        curr_client->client_username = malloc(sizeof(char) * (strlen(buf) + 1));
        printf("4\n");
        strcpy(curr_client->client_username, buf);
        printf("5\n");
        curr_client->client_username[num_read] = '\0';
        printf("6\n");
    }
    write(client_fd, "Go ahead and enter user commands\n", 34);
}
