diff options
-rw-r--r-- | Changelog-Trunk.txt | 2 | ||||
-rw-r--r-- | src/map/clif.c | 7 |
2 files changed, 7 insertions, 2 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index 48b7eb788..478570ad9 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -4,6 +4,8 @@ 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.
2006/04/20
+ * Fixed buffer overflow in clif_MainChatMessage. It now prints a Debug
+ message with the offending line. [Skotlex]
* Cleaned up a bunch of GS/NJ skills [Skotlex]
* Fixed Gatling Fever crashing server when used by non players. [Skotlex]
* Added support for n to specify minutes to @charban. [Skotlex]
diff --git a/src/map/clif.c b/src/map/clif.c index 3aba4a0a1..0a73e03f4 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -4802,14 +4802,17 @@ void clif_GlobalMessage(struct block_list *bl,char *message) */
void clif_MainChatMessage(char* message) {
- char buf[100];
+ char buf[128];
int len;
if(!message)
return;
len = strlen(message)+1;
-
+ if (len+8 > sizeof(buf)) {
+ ShowDebug("clif_MainChatMessage: Received message too long (len %d): %s\n", len, message);
+ len = sizeof(buf)-8;
+ }
WBUFW(buf,0)=0x8d;
WBUFW(buf,2)=len+8;
WBUFL(buf,4)=0;
|