should malloc be assigned sizeof(char) * num_read or sizeof(char) * (1 + num_read) ?
int num_read = read(fd, &buf, BUF_SIZE);
buf[num_read] = '\0';
users[client_index].username = malloc(sizeof(char) * num_read);