Update student grade management system with security improvements and bug fixes

This commit is contained in:
2025-09-12 23:02:10 +08:00
parent 28db1b4a01
commit f208059b70
16 changed files with 1052 additions and 594 deletions
+4 -2
View File
@@ -61,7 +61,8 @@ void displayCourseStatistics()
}
if (!exists)
{
strcpy(courses[courseCount], students[i].courses[j]);
strncpy(courses[courseCount], students[i].courses[j], MAX_COURSE_NAME_LENGTH - 1);
courses[courseCount][MAX_COURSE_NAME_LENGTH - 1] = '\0';
courseCount++;
}
}
@@ -410,7 +411,8 @@ OverallStats calculateOverallStats()
}
if (!exists)
{
strcpy(courses[uniqueCourseCount], students[i].courses[j]);
strncpy(courses[uniqueCourseCount], students[i].courses[j], MAX_COURSE_NAME_LENGTH - 1);
courses[uniqueCourseCount][MAX_COURSE_NAME_LENGTH - 1] = '\0';
uniqueCourseCount++;
}
}