Skip to content

Commit

Permalink
Fix unsafe (and pointless) use of sprintf()
Browse files Browse the repository at this point in the history
  • Loading branch information
vslavik committed Jun 12, 2020
1 parent 73c6ecb commit 103649b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions signus/src/units.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1168,7 +1168,7 @@ void TUnit::GetFieldInfo(int x, int y, char *buf)
if (GetAircraftAt(x, y))
sprintf(buf, "%s - %s", GetAircraftAt(x, y)->GetName(), SigText[TXT_OUT_OF_WPNRNG]);
else
sprintf(buf, SigText[TXT_OUT_OF_WPNRNG]);
strcpy(buf, SigText[TXT_OUT_OF_WPNRNG]);
}
else if (GetAircraftAt(x, y) != NULL) {
sprintf(b, SigText[TXT_TELL_STATE],
Expand All @@ -1181,8 +1181,8 @@ void TUnit::GetFieldInfo(int x, int y, char *buf)
if ((ttm = TimeToMove(x, y)) >= 0)
sprintf(buf, SigText[TXT_TELL_TIME], TimeUnits-ttm);
else {
if (ttm == -1) sprintf(buf, SigText[TXT_OUT_OF_RANGE]);
else if (ttm == -2) sprintf(buf, SigText[TXT_NO_ACCESS]);
if (ttm == -1) strcpy(buf, SigText[TXT_OUT_OF_RANGE]);
else if (ttm == -2) strcpy(buf, SigText[TXT_NO_ACCESS]);
}
break;
}
Expand Down

0 comments on commit 103649b

Please sign in to comment.