Skip to content

Commit

Permalink
avoid passing null to atoi() (undefined behavior) if mission ini file…
Browse files Browse the repository at this point in the history
… declares bigger MissionCount than actual list of missions, lifted from vanilla-conquer
  • Loading branch information
ChthonVII committed Jun 23, 2021
1 parent 4ee13e0 commit 4a20df9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion TIBERIANDAWN/TEAMTYPE.CPP
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,9 @@ void TeamTypeClass::Fill_In(char * name, char *entry)
p1 = strtok(NULL,",:");
p2 = strtok(NULL,",:");
mission.Mission = Mission_From_Name(p1);
mission.Argument = atoi(p2);
// Chthon CFE Note: avoid passing null to atoi() (undefined behavior) if mission ini file declares bigger MissionCount than actual list of missions, as per https://github.com/TheAssemblyArmada/Vanilla-Conquer/pull/529
//mission.Argument = atoi(p2);
mission.Argument = p2 ? atoi(p2) : 0;
MissionList[i] = mission;
}

Expand Down

0 comments on commit 4a20df9

Please sign in to comment.