I'm getting a segmentation fault at line 50
typedef struct rule_node {
    char *target;
    Dependency *dependencies;
    Action *actions;
    struct rule_node *next_rule;
} Rule;

Rule *parse_file(FILE *fp) {
    // Implement this function and remove the stubbed return statement below.

    // For reading lines
    char line[MAXLINE + 1];

    // For linked list traversal
    Rule *curr = NULL;

    // Create a pointer to the head of our rules linked list
    Rule *head = curr;

    while (fgets(line, MAXLINE + 1, fp) != NULL) {
        // Change new line character to null terminator
        int len = strlen(line);
        line[len - 1] = '\0';

        // Only do things to lines that are not comments or empty
        if (!is_comment_or_empty(line)) {
            // Case for action line
            if (line[0] == '\t') {
            }
            // Case for target line
            else {
                // Getting target
                char *p = strstr(line, " :");
                int length = p - line;
                line[length] = '\0';

                // Creating a new rule
                Rule *rule = malloc(sizeof(Rule));
                if (curr == NULL) {
                    curr = rule;
                    head = curr;
                } else {
                    curr->next_rule = rule;
                    curr = curr->next_rule;
                }
                rule->next_rule = NULL;
                strcpy(rule->target, line);
                rule->dependencies = NULL;
                rule->actions = NULL;

                // TODO: deal with dependencies
                char *dependencies = p + 2;
            }
        }
    }
    curr = head;
    while (curr != NULL) {
        printf("%s\n", curr->target);
        curr = curr->next_rule;
    }
    return head;
}