User *find_user(const char *name, const User *head) {
    User *curr_user = head->next; //TODO: try without typecast

    if(head != NULL && strcmp(head->name, name) == 0){
        return (User *)head;
    }

    //traverse the list of users
    while(curr_user != NULL){
        //check if the given name and the name of the current user are the same
        if(strcmp(name, curr_user->name) == 0){
            return curr_user;
        }
        curr_user = curr_user->next;
    }
    printf("gonna return NULL");
    return NULL;
}
The head pointer is not checked for the name. -> This is fixed by adding a check for the head pointer.