소스 검색

Fixed yet another buffer overflow, in @adopt
(caused by a conflict between a mass replace in r2207 and very dumb variable reuse in r1316)

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@11955 54d463be-8e91-2dee-dedb-b68131a5f0ec

ultramage 17 년 전
부모
커밋
6730ae32cc
2개의 변경된 파일8개의 추가작업 그리고 6개의 파일을 삭제
  1. 1 0
      Changelog-Trunk.txt
  2. 7 6
      src/map/atcommand.c

+ 1 - 0
Changelog-Trunk.txt

@@ -4,6 +4,7 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK.  ALL UNTESTED BUGFIXES/FEATURES GO
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 
 2007/12/19
+	* Fixed yet another buffer overflow, in @adopt [ultramage]
 	* Changes to the configure script. [FlavioJS]
 	- fixed the 'pointers can be stored in ints' test not working
 	- fixed the linker trying to build 64 bit executables with 32 bit code on 

+ 7 - 6
src/map/atcommand.c

@@ -7495,6 +7495,7 @@ int atcommand_adopt(const int fd, struct map_session_data* sd, const char* comma
 	struct map_session_data *pl_sd2 = NULL;
 	struct map_session_data *pl_sd3 = NULL;
 	char player1[NAME_LENGTH], player2[NAME_LENGTH], player3[NAME_LENGTH];
+	char output[256];
 	
         nullpo_retr(-1, sd);
 
@@ -7507,20 +7508,20 @@ int atcommand_adopt(const int fd, struct map_session_data* sd, const char* comma
 	        printf("Adopting: --%s--%s--%s--\n",player1,player2,player3);
 
         if((pl_sd1=map_nick2sd((char *) player1)) == NULL) {
-                sprintf(player2, "Cannot find player %s online", player1);
-                clif_displaymessage(fd, player2);
+                sprintf(output, "Cannot find player %s online", player1);
+                clif_displaymessage(fd, output);
                 return -1;
         }
 
         if((pl_sd2=map_nick2sd((char *) player2)) == NULL) {
-                sprintf(player1, "Cannot find player %s online", player2);
-                clif_displaymessage(fd, player1);
+                sprintf(output, "Cannot find player %s online", player2);
+                clif_displaymessage(fd, output);
                 return -1;
 	}
  
        if((pl_sd3=map_nick2sd((char *) player3)) == NULL) {
-                sprintf(player1, "Cannot find player %s online", player3);
-                clif_displaymessage(fd, player1);
+                sprintf(output, "Cannot find player %s online", player3);
+                clif_displaymessage(fd, output);
                 return -1;
         }