Pārlūkot izejas kodu

Update

git-svn-id: https://svn.code.sf.net/p/rathena/svn/branches/stable@867 54d463be-8e91-2dee-dedb-b68131a5f0ec
amber 20 gadi atpakaļ
vecāks
revīzija
28b28129e5
3 mainītis faili ar 16 papildinājumiem un 6 dzēšanām
  1. 1 0
      Changelog.txt
  2. 7 0
      src/map/intif.c
  3. 8 6
      src/map/storage.c

+ 1 - 0
Changelog.txt

@@ -1,5 +1,6 @@
 Date	Added
 12/29
+	* Double storage/lag exploit fixed (SVN 867) [MouseJstr]
 	* Another -1 alive_timer fix (SVN 866) [MouseJstr]
 	* Added @dmstart and @dmtick for debugging malloc tests [MouseJstr]
 	* Fix some more compile errors on different platforms [MouseJstr]

+ 7 - 0
src/map/intif.c

@@ -734,6 +734,13 @@ int intif_parse_LoadStorage(int fd) {
 	struct map_session_data *sd;
 
 	stor = account2storage( RFIFOL(fd,4));
+
+	if (stor->storage_status == 1) { // Already open.. lets ignore this update
+		if (battle_config.error_log)
+			printf("intif_parse_LoadStorage: storage received for a client already open\n");
+		return 0;
+	}
+
 	if (RFIFOW(fd,2)-8 != sizeof(struct storage)) {
 		if (battle_config.error_log)
 			printf("intif_parse_LoadStorage: data size error %d %d\n", RFIFOW(fd,2)-8, sizeof(struct storage));

+ 8 - 6
src/map/storage.c

@@ -110,12 +110,14 @@ int storage_storageopen(struct map_session_data *sd)
 	nullpo_retr(0, sd);
 
 	if((stor = numdb_search(storage_db,sd->status.account_id)) != NULL) {
-		stor->storage_status = 1;
-		sd->state.storage_flag = 0;
-		clif_storageitemlist(sd,stor);
-		clif_storageequiplist(sd,stor);
-		clif_updatestorageamount(sd,stor);
-		return 0;
+		if (stor->storage_status == 0) {
+			stor->storage_status = 1;
+			sd->state.storage_flag = 0;
+			clif_storageitemlist(sd,stor);
+			clif_storageequiplist(sd,stor);
+			clif_updatestorageamount(sd,stor);
+			return 0;
+		}	
 	} else
 		intif_request_storage(sd->status.account_id);