File tree 1 file changed +10
-9
lines changed
1 file changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -762,14 +762,14 @@ void Server::handleCommand_GotBlocks(NetworkPacket* pkt)
762
762
763
763
RemoteClient *client = getClient (pkt->getPeerId ());
764
764
765
- for (u16 i = 0 ; i < count; i++) {
766
- if ((s16)pkt->getSize () < 1 + (i + 1 ) * 6 )
767
- throw con::InvalidIncomingDataException
765
+ if ((s16)pkt->getSize () < 1 + (int )count * 6 ) {
766
+ throw con::InvalidIncomingDataException
768
767
(" GOTBLOCKS length is too short" );
769
- v3s16 p;
768
+ }
770
769
770
+ for (u16 i = 0 ; i < count; i++) {
771
+ v3s16 p;
771
772
*pkt >> p;
772
-
773
773
client->GotBlock (p);
774
774
}
775
775
}
@@ -865,13 +865,14 @@ void Server::handleCommand_DeletedBlocks(NetworkPacket* pkt)
865
865
866
866
RemoteClient *client = getClient (pkt->getPeerId ());
867
867
868
- for (u16 i = 0 ; i < count; i++) {
869
- if ((s16)pkt->getSize () < 1 + (i + 1 ) * 6 )
870
- throw con::InvalidIncomingDataException
868
+ if ((s16)pkt->getSize () < 1 + (int )count * 6 ) {
869
+ throw con::InvalidIncomingDataException
871
870
(" DELETEDBLOCKS length is too short" );
871
+ }
872
+
873
+ for (u16 i = 0 ; i < count; i++) {
872
874
v3s16 p;
873
875
*pkt >> p;
874
-
875
876
client->SetBlockNotSent (p);
876
877
}
877
878
}
You can’t perform that action at this time.
0 commit comments