Complete.Org: Mailing Lists: Archives: freeciv-dev: December 2003:
[Freeciv-Dev] (PR#7058) Add checks for city_style chosen by player
Home

[Freeciv-Dev] (PR#7058) Add checks for city_style chosen by player

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#7058) Add checks for city_style chosen by player
From: "mateusz stefek" <matusik_s@xxxxx>
Date: Sat, 6 Dec 2003 06:53:00 -0800
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=7058 >

These two little patches add code which checks value of city_style field in 
select_nation packet.

check_city_style.diff is for S1_14
check_city_style_head.diff is for HEAD
--
mateusz

--- freeorig/server/srv_main.c  2003-11-19 13:17:49.000000000 +0100
+++ freeciv/server/srv_main.c   2003-11-24 15:18:32.000000000 +0100
@@ -1050,8 +1050,10 @@
                         "of SELECT_RACES_STATE!"));
     return;
   }  
-  
-  if (packet->nation_no < 0 || packet->nation_no >= game.nation_count) {
+  /* check sanity of the packet */
+  if (packet->nation_no < 0 || packet->nation_no >= game.nation_count ||
+      packet->city_style < 0 || packet->city_style >= game.styles_count ||
+      city_styles[packet->city_style].techreq != A_NONE) {
     return;
   }
 
--- freeorig/server/srv_main.c  2003-12-02 09:16:20.000000000 +0100
+++ freeciv/server/srv_main.c   2003-12-02 21:16:59.000000000 +0100
@@ -909,7 +909,10 @@
     return;
   }  
   
-  if (nation_no < 0 || nation_no >= game.nation_count) {
+  /* check sanity of the packet sent by client */
+  if (nation_no < 0 || nation_no >= game.nation_count ||
+      city_style < 0 || city_style >= game.styles_count ||
+      city_styles[city_style].techreq != A_NONE) {
     return;
   }
 

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#7058) Add checks for city_style chosen by player, mateusz stefek <=