- Check for incoming buffer overflow
- Fix incorrect position of attack bar in some cases
--- a/hedgewars/uIO.pas Sat May 26 20:47:36 2007 +0000
+++ b/hedgewars/uIO.pas Sun May 27 13:53:41 2007 +0000
@@ -36,10 +36,11 @@
implementation
uses uConsole, uConsts, uWorld, uMisc, uLand;
const isPonged: boolean = false;
+ MAXCMDS = 65535;
var IPCSock: PTCPSocket = nil;
fds: PSDLNet_SocketSet;
- extcmd: array[word] of packed record
+ extcmd: array[0..MAXCMDS] of packed record
Time: LongWord;
case byte of
1: (len: byte;
@@ -89,6 +90,7 @@
else OutError(errmsgIncorrectUse + ' IPC "T" :' + s[2], true) end;
else
inc(cmdendpos);
+ TryDo(cmdendpos <= MAXCMDS, 'Too many commands in queue', true);
extcmd[cmdendpos].Time := SDLNet_Read32(@s[byte(s[0]) - 3]);
extcmd[cmdendpos].str := s;
{$IFDEF DEBUGFILE}AddFileLog('IPC in: '+s[1]+' ticks '+inttostr(extcmd[cmdendpos].Time)+' at '+inttostr(cmdendpos));{$ENDIF}
--- a/hedgewars/uWorld.pas Sat May 26 20:47:36 2007 +0000
+++ b/hedgewars/uWorld.pas Sun May 27 13:53:41 2007 +0000
@@ -247,8 +247,8 @@
tdx:= hwSign(Gear^.dX) * Sin(Gear^.Angle * Pi / cMaxAngle);
tdy:= - Cos(Gear^.Angle * Pi / cMaxAngle);
for i:= (Gear^.Power * 24) div cPowerDivisor downto 0 do
- DrawSprite(sprPower, Gear^.X.Round + system.round(WorldDx + tdx * (24 + i * 2)) - 16,
- Gear^.Y.Round + system.round(WorldDy + tdy * (24 + i * 2)) - 12,
+ DrawSprite(sprPower, hwRound(Gear^.X) + system.round(WorldDx + tdx * (24 + i * 2)) - 16,
+ hwRound(Gear^.Y) + system.round(WorldDy + tdy * (24 + i * 2)) - 12,
i, Surface)
end
end;