summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/char/inter.c16
-rw-r--r--src/map/intif.c8
2 files changed, 13 insertions, 11 deletions
diff --git a/src/char/inter.c b/src/char/inter.c
index 8b66514e9..4cbb1e32b 100644
--- a/src/char/inter.c
+++ b/src/char/inter.c
@@ -419,19 +419,21 @@ const char* geoip_getcountry(uint32 ipnum){
void inter_to_fd(int fd, int u_fd, int aid, char* msg, ...) {
char msg_out[512];
va_list ap;
+ int len = 1;/* yes we start at 1 */
va_start(ap,msg);
- vsprintf(msg_out, msg, ap);
+ len += vsnprintf(msg_out, 512, msg, ap);
va_end(ap);
-
- WFIFOHEAD(fd,522);
+
+ WFIFOHEAD(fd,12 + len);
WFIFOW(fd,0) = 0x3807;
- WFIFOL(fd,2) = u_fd;
- WFIFOL(fd,6) = aid;
- safestrncpy((char*)WFIFOP(fd,10), msg_out, 512);
+ WFIFOW(fd,2) = 12 + (unsigned short)len;
+ WFIFOL(fd,4) = u_fd;
+ WFIFOL(fd,8) = aid;
+ safestrncpy((char*)WFIFOP(fd,12), msg_out, len);
- WFIFOSET(fd,522);
+ WFIFOSET(fd,12 + len);
return;
}
diff --git a/src/map/intif.c b/src/map/intif.c
index 2374eaf38..5804bcfba 100644
--- a/src/map/intif.c
+++ b/src/map/intif.c
@@ -34,7 +34,7 @@
static const int packet_len_table[]={
- -1,-1,27,-1, -1, 0,37, 522, 0, 0, 0, 0, 0, 0, 0, 0, //0x3800-0x380f
+ -1,-1,27,-1, -1, 0,37,-1, 0, 0, 0, 0, 0, 0, 0, 0, //0x3800-0x380f
0, 0, 0, 0, 0, 0, 0, 0, -1,11, 0, 0, 0, 0, 0, 0, //0x3810
39,-1,15,15, 14,19, 7,-1, 0, 0, 0, 0, 0, 0, 0, 0, //0x3820
10,-1,15, 0, 79,19, 7,-1, 0,-1,-1,-1, 14,67,186,-1, //0x3830
@@ -2140,15 +2140,15 @@ void intif_request_accinfo( int u_fd, int aid, int group_id, char* query ) {
}
void intif_parse_MessageToFD(int fd) {
- int u_fd = RFIFOL(fd,2);
+ int u_fd = RFIFOL(fd,4);
if( session[u_fd] && session[u_fd]->session_data ) {
- int aid = RFIFOL(fd,6);
+ int aid = RFIFOL(fd,8);
struct map_session_data * sd = session[u_fd]->session_data;
/* matching e.g. previous fd owner didn't dc during request or is still the same */
if( sd->bl.id == aid ) {
char msg[512];
- safestrncpy(msg, (char*)RFIFOP(fd,10), 512);
+ safestrncpy(msg, (char*)RFIFOP(fd,12), RFIFOW(fd,2) - 12);
clif_displaymessage(u_fd,msg);
}