diff options
author | Lance <Lance@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-05-28 11:29:43 +0000 |
---|---|---|
committer | Lance <Lance@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-05-28 11:29:43 +0000 |
commit | a77e818f841305d286d2e472893ff132751e4291 (patch) | |
tree | 46a013e0c4bae181f816638940dc3114dcb086ee | |
parent | 7cea1d3255f07c7454cb207a329bbe887446d344 (diff) | |
download | hercules-a77e818f841305d286d2e472893ff132751e4291.tar.gz hercules-a77e818f841305d286d2e472893ff132751e4291.tar.bz2 hercules-a77e818f841305d286d2e472893ff132751e4291.tar.xz hercules-a77e818f841305d286d2e472893ff132751e4291.zip |
* [ Protected ] : clif_parse_LGMmessage from possible hacks
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6797 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r-- | Changelog-Trunk.txt | 1 | ||||
-rw-r--r-- | src/map/clif.c | 12 |
2 files changed, 10 insertions, 3 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index 24fd2e55f..6cac17b06 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.
2006/05/28
+ * [ Protected ] : clif_parse_LGMmessage from possible hacks [Lance]
* Fixed unable to store n items into storage unless n was the total amount
of items you had. [Skotlex]
* Suppressed compilation warnings (unsigned and signed mismatches) [Lance]
diff --git a/src/map/clif.c b/src/map/clif.c index a485a1501..1b4ec6e93 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -10070,14 +10070,20 @@ void clif_parse_ResetChar(int fd, struct map_session_data *sd) { */
void clif_parse_LGMmessage(int fd, struct map_session_data *sd) {
unsigned char buf[512];
+ int len = RFIFOREST(fd);
+ int plen = RFIFOW(fd,2);
RFIFOHEAD(fd);
+ if(plen <= 0 || plen > len) // Possible hack! [Lance]
+ plen = len;
+
if ((battle_config.atc_gmonly == 0 || pc_isGM(sd)) &&
(pc_isGM(sd) >= get_atcommand_level(AtCommand_LocalBroadcast))) {
WBUFW(buf,0) = 0x9a;
- WBUFW(buf,2) = RFIFOW(fd,2);
- memcpy(WBUFP(buf,4), RFIFOP(fd,4), RFIFOW(fd,2) - 4);
- clif_send(buf, RFIFOW(fd,2), &sd->bl, ALL_SAMEMAP);
+ WBUFW(buf,2) = plen;
+ memcpy(WBUFP(buf,4), RFIFOP(fd,4), plen - 4);
+ WBUFB(buf,plen-1) = '\0'; // Must have NULL termination [Lance]
+ clif_send(buf, plen, &sd->bl, ALL_SAMEMAP);
}
}
|