this leads to a segmentation fault, how to fix?
int create_user(const char *name, User **user_ptr_add) {

    User *curr_user = *user_ptr_add;

    if (strlen(name) > 29) {
        return 2;
    }
    while (curr_user->next != NULL) {
        if (strcmp(name, curr_user->name) == 0) {
            return 1;
        }
        curr_user = curr_user->next;
}
    struct user new_user;

    strncpy(new_user.name, name, strlen(name));
    new_user.name[strlen(name)] = '\0';
    new_user.profile_pic[0] = '\0';
    new_user.first_post = NULL;
    memset(new_user.friends, '\0', sizeof(new_user.friends));
    new_user.next = NULL;
    return 0;