summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-02-02 02:11:48 +0000
committerultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-02-02 02:11:48 +0000
commitb57f249609212b256244a5be2d7223806f3008da (patch)
tree40344664c2f560144a74dbffbc6ba66d0137ed79
parentd0df506ec43e3f74aa4a95d7a6f64acba7a864b5 (diff)
downloadhercules-b57f249609212b256244a5be2d7223806f3008da.tar.gz
hercules-b57f249609212b256244a5be2d7223806f3008da.tar.bz2
hercules-b57f249609212b256244a5be2d7223806f3008da.tar.xz
hercules-b57f249609212b256244a5be2d7223806f3008da.zip
Corrected the chat system to allow 8-letter passwords
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@9772 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r--Changelog-Trunk.txt1
-rw-r--r--src/map/chat.c15
-rw-r--r--src/map/map.h4
3 files changed, 10 insertions, 10 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index 7bb12b0a2..177b20955 100644
--- a/Changelog-Trunk.txt
+++ b/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/02/01
+ * Corrected the chat system to allow 8-letter passwords
* Minor details (pdb file location, improved debug, npc typo)
* Cleaned up the npcshop(add/del)item script commands, fixed a possible
dangling pointer crash caused by their improper use of realloc. They no
diff --git a/src/map/chat.c b/src/map/chat.c
index 8a0844015..0bc95ca9c 100644
--- a/src/map/chat.c
+++ b/src/map/chat.c
@@ -17,10 +17,10 @@
int chat_triggerevent(struct chat_data *cd);
/*==========================================
- * チャットルーム作成
+ * chatroom creation
*------------------------------------------
*/
-int chat_createchat(struct map_session_data *sd,int limit,int pub,char* pass,char* title,int titlelen)
+int chat_createchat(struct map_session_data* sd,int limit, int pub, char* pass, char* title, int titlelen)
{
struct chat_data *cd;
@@ -39,11 +39,10 @@ int chat_createchat(struct map_session_data *sd,int limit,int pub,char* pass,cha
cd->limit = limit;
cd->pub = pub;
cd->users = 1;
- memcpy(cd->pass,pass,8);
- cd->pass[7]= '\0'; //Overflow check... [Skotlex]
- if(titlelen>=sizeof(cd->title)-1) titlelen=sizeof(cd->title)-1;
- memcpy(cd->title,title,titlelen);
- cd->title[titlelen]=0;
+ titlelen = cap_value(titlelen, 0, sizeof(cd->title)-1); // empty string achievable by using custom client
+ // the following two input strings aren't zero terminated, have to handle it manually
+ memcpy(cd->pass, pass, 8); cd->pass[8]= '\0';
+ memcpy(cd->title, title, titlelen); cd->title[titlelen] = '\0';
cd->owner = (struct block_list **)(&cd->usersd[0]);
cd->usersd[0] = sd;
@@ -70,7 +69,7 @@ int chat_createchat(struct map_session_data *sd,int limit,int pub,char* pass,cha
* 既存チャットルームに参加
*------------------------------------------
*/
-int chat_joinchat (struct map_session_data *sd, int chatid, char* pass)
+int chat_joinchat(struct map_session_data* sd, int chatid, char* pass)
{
struct chat_data *cd;
diff --git a/src/map/map.h b/src/map/map.h
index 8f553ab01..54b04ce63 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -1273,8 +1273,8 @@ enum {
struct chat_data {
struct block_list bl;
- unsigned char pass[8]; /* password */
- unsigned char title[61]; /* room title MAX 60 */
+ unsigned char pass[8+1]; /* password */
+ unsigned char title[60+1]; /* room title */
unsigned char limit; /* join limit */
unsigned char trigger;
unsigned char users; /* current users */