Przeglądaj źródła

- @stfu now allows negative intervals to be specified, they increase manner instead.
- Added overflow fix to the login-server when sending GM accounts to char.
- Increased buffer size abit in check_ip (login.c) to see if it prevents stack corruption.


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

skotlex 19 lat temu
rodzic
commit
42de903b04
4 zmienionych plików z 16 dodań i 3 usunięć
  1. 3 0
      Changelog-Trunk.txt
  2. 6 2
      src/login/login.c
  3. 4 0
      src/login_sql/login.c
  4. 3 1
      src/map/atcommand.c

+ 3 - 0
Changelog-Trunk.txt

@@ -6,6 +6,9 @@ GOES INTO TRUNK AND WILL BE MERGED INTO STABLE BY VALARIS AND WIZPUTER. -- VALAR
 
 
 2006/03/18
+	* @stfu now allows negative intervals to be specified. [Skotlex]
+	* Added overflow check to the login-server when sending GM accounts to
+	  char. [Skotlex]
 	* Small fix to prevent killer/killable states from allowing you to target
 	  yourself. [Skotlex]
 	* Added Explosion Spirits to list of effects that dispel on logout.

+ 6 - 2
src/login/login.c

@@ -413,7 +413,7 @@ int check_ipmask(unsigned int ip, const unsigned char *str) {
 int check_ip(unsigned int ip) {
 	int i;
 	unsigned char *p = (unsigned char *)&ip;
-	char buf[16];
+	char buf[20];
 	char * access_ip;
 	enum { ACF_DEF, ACF_ALLOW, ACF_DENY } flag = ACF_DEF;
 
@@ -462,7 +462,7 @@ int check_ip(unsigned int ip) {
 int check_ladminip(unsigned int ip) {
 	int i;
 	unsigned char *p = (unsigned char *)&ip;
-	char buf[16];
+	char buf[20];
 	char * access_ip;
 
 	if (access_ladmin_allownum == 0)
@@ -1034,6 +1034,10 @@ void send_GM_accounts(void) {
 			WBUFL(buf,len) = gm_account_db[i].account_id;
 			WBUFB(buf,len+4) = (unsigned char)gm_account_db[i].level;
 			len += 5;
+			if (len >= 32000) {
+				ShowWarning("send_GM_accounts: Too many accounts! Only %d out of %d were sent.\n", i, GM_num);
+				break;
+			}
 		}
 	WBUFW(buf,2) = len;
 	charif_sendallwos(-1, buf, len);

+ 4 - 0
src/login_sql/login.c

@@ -262,7 +262,11 @@ void send_GM_accounts(int fd) {
 				WBUFL(buf,len) = gm_account_db[i].account_id;
 				WBUFB(buf,len+4) = (unsigned char)gm_account_db[i].level;
 				len += 5;
+				if (len >= 32000) {
+				ShowWarning("send_GM_accounts: Too many accounts! Only %d out of %d were sent.\n", i, GM_num);
+				break;
 			}
+		}
 		WBUFW(buf,2) = len;
 		if (fd == -1)
 			charif_sendallwos(-1, buf, len);

+ 3 - 1
src/map/atcommand.c

@@ -9596,6 +9596,8 @@ static int atcommand_mutearea_sub(struct block_list *bl,va_list ap)
 		pl_sd->status.manner -= time;
 		if (pl_sd->status.manner < 0)
 			sc_start(&pl_sd->bl,SC_NOCHAT,100,0,0);
+		else if (pl_sd->sc.count && pl_sd->sc.data[SC_NOCHAT].timer != -1)
+			status_change_end(&pl_sd->bl, SC_NOCHAT, -1);
 	}
 	return 0;
 }
@@ -9617,7 +9619,7 @@ int atcommand_mutearea(
 	}
 
 	time = atoi(message);
-	if (time <= 0)
+	if (!time)
 		time = 15; // 15 minutes default
 	map_foreachinarea(atcommand_mutearea_sub,sd->bl.m, 
 		sd->bl.x-AREA_SIZE, sd->bl.y-AREA_SIZE,