From 1b968f83d51a3247e5ee528e77fb16942546141f Mon Sep 17 00:00:00 2001 From: ai4rei Date: Wed, 1 Dec 2010 20:57:47 +0000 Subject: * Fixed using main chat nick longer than 15 characters would cause a buffer overflow (bugreport:2671, since r5013). git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14537 54d463be-8e91-2dee-dedb-b68131a5f0ec --- Changelog-Trunk.txt | 1 + src/char/inter.c | 2 +- src/char_sql/inter.c | 2 +- src/map/map.c | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index 097077d88..292fd6fb4 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -1,6 +1,7 @@ Date Added 2010/12/01 + * Fixed using main chat nick longer than 15 characters would cause a buffer overflow (bugreport:2671, since r5013). [Ai4rei] * Fixed bAutoSpellOnSkill bonuses could not be chained (bugreport:4421, since r13596). [Ai4rei] * Fixed NPC_TALK message being displayed with EOL character attached (bugreport:4596, since r14270). [Ai4rei] * Reverted change from r14533 and restored the 3rd field of mob_avail.txt being optional (bugreport:4599, since r14532). [Ai4rei] diff --git a/src/char/inter.c b/src/char/inter.c index 051d8117a..8d9cac99f 100644 --- a/src/char/inter.c +++ b/src/char/inter.c @@ -210,7 +210,7 @@ static int inter_config_read(const char *cfgName) { } else if(strcmpi(w1,"log_inter")==0) { log_inter = atoi(w2); } else if(strcmpi(w1, "main_chat_nick")==0){ // Main chat nick [LuzZza] - strcpy(main_chat_nick, w2); + safestrncpy(main_chat_nick, w2, sizeof(main_chat_nick)); #endif //TXT_SQL_CONVERT } else if (strcmpi(w1, "import") == 0) { inter_config_read(w2); diff --git a/src/char_sql/inter.c b/src/char_sql/inter.c index 2f5c2daff..97c48bdf1 100644 --- a/src/char_sql/inter.c +++ b/src/char_sql/inter.c @@ -235,7 +235,7 @@ static int inter_config_read(const char* cfgName) else if(!strcmpi(w1,"log_inter")) log_inter = atoi(w2); else if(!strcmpi(w1,"main_chat_nick")) - strcpy(main_chat_nick, w2); + safestrncpy(main_chat_nick, w2, sizeof(main_chat_nick)); #endif //TXT_SQL_CONVERT else if(!strcmpi(w1,"import")) inter_config_read(w2); diff --git a/src/map/map.c b/src/map/map.c index 5f4a1cf16..7fa7d4f7a 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -3205,7 +3205,7 @@ int inter_config_read(char *cfgName) continue; if(strcmpi(w1, "main_chat_nick")==0) - strcpy(main_chat_nick, w2); + safestrncpy(main_chat_nick, w2, sizeof(main_chat_nick)); #ifndef TXT_ONLY else -- cgit v1.2.3-70-g09d2