diff options
author | eathenabot <eathenabot@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2012-05-31 05:28:43 +0000 |
---|---|---|
committer | eathenabot <eathenabot@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2012-05-31 05:28:43 +0000 |
commit | b258a76313a6273c645d419eb360468a78840200 (patch) | |
tree | b2501fea48dda46cfb837bef99b45177a7f59e38 /src | |
parent | 1d3059bf05dcd1ed986a33eff7d9e35f381ef3ba (diff) | |
download | hercules-b258a76313a6273c645d419eb360468a78840200.tar.gz hercules-b258a76313a6273c645d419eb360468a78840200.tar.bz2 hercules-b258a76313a6273c645d419eb360468a78840200.tar.xz hercules-b258a76313a6273c645d419eb360468a78840200.zip |
* Merged changes up to eAthena 15111.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@16175 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r-- | src/map/clif.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/map/clif.c b/src/map/clif.c index 97e96ec8e..56f1deb6d 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -5316,12 +5316,14 @@ void clif_displaymessage(const int fd, const char* mes) message = aStrdup(mes); line = strtok(message, "\n"); while(line != NULL) { - int len = strlen(line); + // Limit message to 255+1 characters (otherwise it causes a buffer overflow in the client) + int len = strnlen(line, 255); + if (len > 0) { // don't send a void message (it's not displaying on the client chat). @help can send void line. WFIFOHEAD(fd, 5 + len); WFIFOW(fd,0) = 0x8e; WFIFOW(fd,2) = 5 + len; // 4 + len + NULL teminate - memcpy(WFIFOP(fd,4), line, len + 1); + safestrncpy(WFIFOP(fd,4), line, len + 1); WFIFOSET(fd, 5 + len); } line = strtok(NULL, "\n"); |