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 /src/map | |
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
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/clif.c | 12 |
1 files changed, 9 insertions, 3 deletions
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);
}
}
|