Ver Fonte

- Bug ID #184: Char Creation With An Empty Name [Zephyrus]

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@11377 54d463be-8e91-2dee-dedb-b68131a5f0ec
zephyrus há 17 anos atrás
pai
commit
8c1bd7bfd8
2 ficheiros alterados com 10 adições e 0 exclusões
  1. 3 0
      Changelog-Trunk.txt
  2. 7 0
      src/char_sql/char.c

+ 3 - 0
Changelog-Trunk.txt

@@ -3,6 +3,9 @@ Date	Added
 AS OF SVN REV. 5091, WE ARE NOW USING TRUNK.  ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 
+2007/10/07
+	* Fixed a bug on sql char server not checking the namelength of a new
+	  character. Bug ID #184: Char Creation With An Empty Name [Zephyrus]
 2007/10/06
 	* the mapserver won't exit when no mapcache is found, with use_grf: yes
 	* Fixed some \r uses, now looks better; /thx to Ai4rei (topic:165952)

+ 7 - 0
src/char_sql/char.c

@@ -1104,6 +1104,13 @@ int make_new_char_sql(int fd, unsigned char *dat)
 
 	ShowInfo("New character request (%d)\n", sd->account_id);
 
+	// check lenght of character name
+	if (strlen(name) < 4) {
+		char_log("Create char failed (character name too small): (connection #%d, account: %d, name: '%s').\n",
+		         fd, sd->account_id, dat);
+		return -2;
+	}
+
 	//check name != main chat nick [LuzZza]
 	if(strcmpi(name, main_chat_nick) == 0) {
 		ShowInfo("Create char failed (%d): this nick (%s) reserved for mainchat messages.\n", sd->account_id, name);