why is there a segmentation fault
#include "friends.h"
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
int create_user(const char *name, User **user_ptr_add) {
        if (strlen(name) > (MAX_NAME - 1)){
                return 2;
        }
        else if (*user_ptr_add == NULL){
                *user_ptr_add = malloc(sizeof(User));
                if (*user_ptr_add == NULL){return 3;}
                strncpy((*user_ptr_add)->name, name, (MAX_NAME - 1));
                (*user_ptr_add)->name[(MAX_NAME - 1)] = '\0';
                (*user_ptr_add)->next = NULL;
                (*user_ptr_add)->profile_pic[0] = '\0';
                return 0;
        }
        else{
                User *p = malloc(sizeof(User));
                if (p == NULL){return 3;}
                strncpy(p->name, name, (MAX_NAME - 1));
                p->name[(MAX_NAME - 1)] = '\0';
                p->next = NULL;
                (*user_ptr_add)->profile_pic[0] = '\0';
                User *curr = *user_ptr_add;
                while (curr->next != NULL){
                        if (strcmp(curr->name, name) == 0){
                                return 1;
                        }
                        curr = curr->next;
                }
                curr->next = p;
                return 0;
        }
}
User *find_user(const char *name, const User *head) {
    User *curr = (User *) head;
    while (curr != NULL){
        if (strcmp(curr->name, name) == 0){
            return &(*curr);
        }
        curr = curr->next;
    }
    return NULL;
}
int make_friends(const char *name1, const char *name2, User *head) {
        if (find_user(name1, head) == NULL || find_user(name2, head) == NULL){return 4;}
        else if (strcmp(name1, name2) == 0){return 3;}
        else{
                User *first = find_user(name1, head);
                User *second = find_user(name2, head);
                int i=0, j=0;
                int val = 0;
                while ((first->friends)[i] != NULL){
                        if (strcmp(((first->friends)[i])->name, name2) == 0){val++;}
                        i++;
                }
                while ((second->friends)[j] != NULL){
                        if (strcmp(((second->friends)[j])->name, name1) == 0){val++;}
                        j++;
                }
                if (((i+1) > (MAX_FRIENDS)) || ((j+1) > (MAX_FRIENDS))){return 2;}
                else if (val == 2){return 1;}
                else {
                        printf("reached else\n");
                        (first->friends)[i] = second;
                        (second->friends)[j] = first;
                        return 0;
                }
        }
}
int main() {
  User *list = NULL;
  int void_val = create_user("11", &list);
  void_val = create_user("1", &list);
  void_val = create_user("2", &list);
  void_val = create_user("3", &list);
  void_val = create_user("4", &list);
  void_val = create_user("5", &list);
  void_val = create_user("6", &list);
  void_val = create_user("7", &list);
  void_val = create_user("8", &list);
  void_val = create_user("9", &list);
  void_val = create_user("10", &list);
  void_val = create_user("12", &list);
  int return_val = make_friends("11", "1");
  return_val = make_friends("11", "2");
  return_val = make_friends("11", "3");
  return_val = make_friends("11", "4");
  return_val = make_friends("11", "5");
  return_val = make_friends("11", "6");
  return_val = make_friends("11", "7");
  return_val = make_friends("11", "8");
  return_val = make_friends("11", "9");
  return_val = make_friends("11", "10");
  return_val = make_friends("11", "12");
  return 0;
}