Run-Time Check Failure #2 - Stack around the variable 'zadanie' was corrupted

В конце программы выдаёт ошибку Run-Time Check Failure #2 - Stack around the variable 'zadanie' was corrupted, не пойму где ошибка

#define _CRT_SECURE_NO_WARNINGS 
#include<stdio.h>
#include<stdlib.h>
#include<locale.h>
#include<string.h>
#include<fstream>
#include<ctime>

struct strDannie
{
    char telefon[12] = {};
    char cod[3] = {};
    char day[3] = {};
    char md[3] = {};
    char year[7] = {};
    char hours[3] = {};
    char min[3] = {};
    char sec[3] = {};
    float vremavsec;
};
struct infoYs
{
    char NameUs[40] = {};
    int cod;
    float tarif;
    char timeDlit[7] = {};
};
struct infoUser
{
    char Name[40] = {};
    char telefon[12] = {};
    char dateon[12] = {};
    char dateoff[12] = {};
    char potrasheno[15] = {};
    char kredit[20] = {};
};
struct vhod
{
    char name[40] = {};
    float maxv=0;
    float otchet[5] = { 0, 0, 0, 0, 0 };

};
int main()
{
    setlocale(LC_ALL, "Rus");
    infoUser klient[10];
    strDannie useYslug[20];
    vhod zadanie;
    infoYs inUslug[5];

    FILE* polz;
    FILE* UZEusluga;
    FILE* input;
    FILE* UsLUGI;
    errno_t one = fopen_s(&polz, "user details.txt", "r");
    errno_t three = fopen_s(&UZEusluga, "ispol.txt", "r");
    errno_t tho = fopen_s(&input, "input.txt", "r");
    errno_t four = fopen_s(&UsLUGI, "uslugi.txt", "r");
    //Поочерёдное открытие файлов и запись из них в структуры.
    if (one || three || tho)
    {
        printf_s("Error\n");
        return -1;
    }
    for (int i = 0; (i < 10) && !feof(polz); i++) {
        fscanf_s(polz, "%[^,]s", &klient[i].Name, 40); fscanf_s(polz, "%*c");
        fscanf_s(polz, "%[^,]s", &klient[i].telefon, 12); fscanf_s(polz, "%*c");
        fscanf_s(polz, "%[^,]s", &klient[i].dateon, 12); fscanf_s(polz, "%*c");
        fscanf_s(polz, "%[^,]s", &klient[i].dateoff,12); fscanf_s(polz, "%*c");
        fscanf_s(polz, "%[^,]s", &klient[i].kredit,20); fscanf_s(polz, "%*c");
        fscanf_s(polz, "%s", &klient[i].potrasheno,15); fscanf_s(polz, "%*c");
    }
    for (int i = 0; (i < 22) && !feof(UZEusluga); i++) {
        fscanf_s(UZEusluga, "%[^,]s", &useYslug[i].telefon, 12); fscanf_s(UZEusluga, "%*c");
        fscanf_s(UZEusluga, "%[^,]s", &useYslug[i].cod,3); fscanf_s(UZEusluga, "%*c");
        fscanf_s(UZEusluga, "%[^.]s", &useYslug[i].day,3); fscanf_s(UZEusluga, "%*c");
        fscanf_s(UZEusluga, "%[^.]s", &useYslug[i].md,3); fscanf_s(UZEusluga, "%*c");
        fscanf_s(UZEusluga, "%[^ ]s", &useYslug[i].year,7); fscanf_s(UZEusluga, "%*c");
        fscanf_s(UZEusluga, "%[^:]s", &useYslug[i].hours,3); fscanf_s(UZEusluga, "%*c");
        fscanf_s(UZEusluga, "%[^:]s", &useYslug[i].min,3); fscanf_s(UZEusluga, "%*c");
        fscanf_s(UZEusluga, "%[^,]s", &useYslug[i].sec,3); fscanf_s(UZEusluga, "%*c");
        fscanf_s(UZEusluga, "%f", &useYslug[i].vremavsec);
        if (useYslug[i].vremavsec < 0) {
            useYslug[i].vremavsec = -1;
            fscanf_s(UZEusluga, "%*c");
        }
        fscanf_s(UZEusluga, "%*c");
    }
    for (int i = 0; (i < 6) && !feof(UsLUGI); i++) {
        fscanf_s(UsLUGI, "%[^,]s", &inUslug[i].NameUs, 40); fscanf_s(UsLUGI, "%*c");
        fscanf_s(UsLUGI, "%d", &inUslug[i].cod); fscanf_s(UsLUGI, "%*c");
        fscanf_s(UsLUGI, "%f", &inUslug[i].tarif); fscanf_s(UsLUGI, "%*c");
        fscanf_s(UsLUGI, "%s", &inUslug[i].timeDlit,7); fscanf_s(UsLUGI, "%*c");
    }
    for (int i = 0; !feof(input); i++)
    {
        fscanf_s(input, "%[^,]s", &zadanie.name, 40); fscanf_s(input, "%*c");
        fscanf_s(input, "%f", &zadanie.maxv); fscanf_s(input, "%*c");
    }
    
    
    fclose(polz);
    fclose(UZEusluga);
    fclose(input);
    fclose(UsLUGI);
    

    //конец записи 
    time_t seconds = time(NULL);
    tm* timeinfo = localtime(&seconds);

    for (int i = 0; (i < 24); i++) // алгоритм основной
    {
        if (strcmp(zadanie.name, useYslug[i].telefon) == 0)
        {
            if ((atoi(useYslug[i].md) - 1) == timeinfo->tm_mon && atoi(useYslug[i].day) <= timeinfo->tm_mday && atoi(useYslug[i].day) >= timeinfo->tm_mday - 3) // проверка на три дня
            {
                if (atoi(useYslug[i].cod) == 1)
                {
                    zadanie.otchet[0] +=  (useYslug[i].vremavsec/60)*inUslug[0].tarif;
                }
                if (atoi(useYslug[i].cod) == 2)
                {
                    zadanie.otchet[1] += inUslug[1].tarif;
                }
                if (atoi(useYslug[i].cod) == 3)
                {
                    zadanie.otchet[2] += (useYslug[i].vremavsec / 60) * inUslug[2].tarif;
                }
                if (atoi(useYslug[i].cod) == 4)
                {
                    zadanie.otchet[3] += (useYslug[i].vremavsec / 60) * inUslug[3].tarif;
                }
                if (atoi(useYslug[i].cod) == 5)
                {
                    zadanie.otchet[4] += (useYslug[i].vremavsec / 60) * inUslug[4].tarif;
                }
            }
        }
    }

    FILE* output;
    errno_t five = fopen_s(&output, "output.txt", "w");
    if (five)
    {
        printf_s("Error\n");
        return -1;
    }
    fprintf(output, "По номеру: %s ", zadanie.name);
    fprintf(output, " было потрачено не менее %f", zadanie.maxv);
    fprintf(output, " по услугам:\n");
    for (int i = 0; i < 5; i++)
    {
        if (zadanie.otchet[i] >= zadanie.maxv)
        {

            fprintf(output, "%s", inUslug[i].NameUs);
            fprintf(output, "\n");
        }

    }
    fclose(output);
    return 0;
}


Ответы (0 шт):