Skip to content

Commit

Permalink
Merge pull request #263 from MaddTheSane/oobArray
Browse files Browse the repository at this point in the history
Fix a couple of out-of-bounds warnings found by Clang.
  • Loading branch information
Lgt2x committed May 2, 2024
2 parents b90566a + 1a75963 commit 2d85304
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Descent3/Mission.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1013,7 +1013,7 @@ bool LoadMission(const char *mssn) {
for (int a = 0; a < MAX_MISSION_URL_COUNT; a++) {
if (Net_msn_URLs.URL[a][0] == '\0') {
strncpy(Net_msn_URLs.URL[a], operand, MAX_MISSION_URL_LEN - 1);
Net_msn_URLs.URL[a][MAX_MISSION_URL_LEN] = '\0';
Net_msn_URLs.URL[a][MAX_MISSION_URL_LEN - 1] = '\0';
mprintf((0, "Found a Mission URL: %s\n", operand));
break;
}
Expand Down
4 changes: 2 additions & 2 deletions netcon/includes/con_dll.h
Original file line number Diff line number Diff line change
Expand Up @@ -1167,9 +1167,9 @@ int StartMultiplayerGameMenu() {
if (!mi)
break;
strncpy(DLLNetgame->mission, mi->msn_file, MSN_NAMELEN);
DLLNetgame->mission[MSN_NAMELEN] = '\0';
DLLNetgame->mission[MSN_NAMELEN - 1] = '\0';
strncpy(DLLNetgame->mission_name, mi->msn_name, MISSION_NAME_LEN);
DLLNetgame->mission_name[MISSION_NAME_LEN] = '\0';
DLLNetgame->mission_name[MISSION_NAME_LEN - 1] = '\0';
#else
// strcpy(DLLNetgame->mission,DLLListGetSelectedIndex(list_1)?"thecore.d3l":"polaris.d3l");

Expand Down
1 change: 0 additions & 1 deletion scripts/AIGame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5730,7 +5730,6 @@ bool GuideBot::DoInit(int me, bool f_reinit) {
memory->powerups[2] = 0;
memory->powerups[3] = 0;
memory->powerups[4] = 0;
memory->powerups[5] = 0;

for (i = 0; i < NUM_GB_SOUNDS; i++) {
memory->sounds[i] = -1;
Expand Down

0 comments on commit 2d85304

Please sign in to comment.