diff options
Diffstat (limited to 'src/char')
-rw-r--r-- | src/char/char.c | 21 | ||||
-rw-r--r-- | src/char/int_guild.c | 8 | ||||
-rw-r--r-- | src/char/int_party.c | 4 | ||||
-rw-r--r-- | src/char/inter.c | 8 |
4 files changed, 24 insertions, 17 deletions
diff --git a/src/char/char.c b/src/char/char.c index b2fc12ddb..1a5fa49e8 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -2,19 +2,26 @@ // original : char2.c 2003/03/14 11:58:35 Rev.1.5 #include <sys/types.h> -#include <sys/socket.h> #include <stdio.h> #include <stdlib.h> + +#ifdef _WIN32 +#include <winsock.h> +typedef long in_addr_t; +#else +#include <sys/socket.h> #include <netinet/in.h> -#include <sys/time.h> -#include <time.h> +#include <arpa/inet.h> +#include <netdb.h> #include <sys/ioctl.h> +#include <sys/time.h> #include <unistd.h> +#endif + +#include <time.h> #include <signal.h> #include <fcntl.h> #include <string.h> -#include <arpa/inet.h> -#include <netdb.h> #include <stdarg.h> #include "../common/strlib.h" @@ -1073,7 +1080,7 @@ void create_online_files(void) { char temp[256]; // to prepare what we must display time_t time_server; // for number of seconds struct tm *datetime; // variable for time in structure ->tm_mday, ->tm_sec, ... - int id[online_players_max]; + int id[4096]; // don't return here if we display nothing, because server[j].users is updated in the first loop. @@ -1822,7 +1829,7 @@ int parse_tologin(int fd) { char_log("'ladmin': Receiving a message for broadcast, but no map-server is online." RETCODE); else { unsigned char buf[128]; - char message[RFIFOL(fd,4) + 1]; // +1 to add a null terminated if not exist in the packet + char message[4096]; // +1 to add a null terminated if not exist in the packet int lp; char *p; memset(message, '\0', sizeof(message)); diff --git a/src/char/int_guild.c b/src/char/int_guild.c index 8b9de1a89..95f0cf099 100644 --- a/src/char/int_guild.c +++ b/src/char/int_guild.c @@ -731,7 +731,7 @@ int mapif_guild_noinfo(int fd, int guild_id) { // ギルド情報まとめ送り int mapif_guild_info(int fd, struct guild *g) { - unsigned char buf[4 + sizeof(struct guild)]; + unsigned char buf[2048]; WBUFW(buf,0) = 0x3831; memcpy(buf + 4, g, sizeof(struct guild)); @@ -805,7 +805,7 @@ int mapif_guild_broken(int guild_id, int flag) { // ギルド内発言 int mapif_guild_message(int guild_id, int account_id, char *mes, int len, int sfd) { - unsigned char buf[len+12]; + unsigned char buf[2048]; WBUFW(buf,0) = 0x3837; WBUFW(buf,2) = len + 12; @@ -832,7 +832,7 @@ int mapif_guild_basicinfochanged(int guild_id, int type, const void *data, int l // ギルドメンバ情報変更通知 int mapif_guild_memberinfochanged(int guild_id, int account_id, int char_id, int type, const void *data, int len) { - unsigned char buf[len + 18]; + unsigned char buf[4096]; WBUFW(buf, 0) = 0x383a; WBUFW(buf, 2) = len + 18; @@ -878,7 +878,7 @@ int mapif_guild_alliance(int guild_id1, int guild_id2, int account_id1, int acco // ギルド役職変更通知 int mapif_guild_position(struct guild *g, int idx) { - unsigned char buf[sizeof(struct guild_position) + 12]; + unsigned char buf[2048]; WBUFW(buf,0) = 0x383b; WBUFW(buf,2) = sizeof(struct guild_position) + 12; diff --git a/src/char/int_party.c b/src/char/int_party.c index 8c87f2cb4..31f489d2e 100644 --- a/src/char/int_party.c +++ b/src/char/int_party.c @@ -281,7 +281,7 @@ int mapif_party_noinfo(int fd, int party_id) { // パ?ティ情報まとめ送り int mapif_party_info(int fd, struct party *p) { - unsigned char buf[4 + sizeof(struct party)]; + unsigned char buf[2048]; WBUFW(buf,0) = 0x3821; memcpy(buf + 4, p, sizeof(struct party)); @@ -368,7 +368,7 @@ int mapif_party_broken(int party_id, int flag) { // パ?ティ??言 int mapif_party_message(int party_id, int account_id, char *mes, int len, int sfd) { - unsigned char buf[len+12]; + unsigned char buf[2048]; WBUFW(buf,0) = 0x3827; WBUFW(buf,2) = len + 12; diff --git a/src/char/inter.c b/src/char/inter.c index a6893aecc..0dca38559 100644 --- a/src/char/inter.c +++ b/src/char/inter.c @@ -296,7 +296,7 @@ int inter_mapif_init(int fd) { // GMメッセージ送信 int mapif_GMmessage(unsigned char *mes, int len, int sfd) { - unsigned char buf[len]; + unsigned char buf[2048]; WBUFW(buf,0) = 0x3800; WBUFW(buf,2) = len; @@ -309,7 +309,7 @@ int mapif_GMmessage(unsigned char *mes, int len, int sfd) { // Wisp/page transmission to all map-server int mapif_wis_message(struct WisData *wd) { - unsigned char buf[56 + wd->len]; + unsigned char buf[2048]; WBUFW(buf, 0) = 0x3801; WBUFW(buf, 2) = 56 + wd->len; @@ -337,7 +337,7 @@ int mapif_wis_end(struct WisData *wd, int flag) { // アカウント変数送信 int mapif_account_reg(int fd, unsigned char *src) { - unsigned char buf[WBUFW(src,2)]; + unsigned char buf[2048]; memcpy(WBUFP(buf,0),src,WBUFW(src,2)); WBUFW(buf, 0) = 0x3804; @@ -489,7 +489,7 @@ int mapif_parse_WisReply(int fd) { // Received wisp message from map-server for ALL gm (just copy the message and resends it to ALL map-servers) int mapif_parse_WisToGM(int fd) { - unsigned char buf[RFIFOW(fd,2)]; // 0x3003/0x3803 <packet_len>.w <wispname>.24B <min_gm_level>.w <message>.?B + unsigned char buf[2048]; // 0x3003/0x3803 <packet_len>.w <wispname>.24B <min_gm_level>.w <message>.?B memcpy(WBUFP(buf,0), RFIFOP(fd,0), RFIFOW(fd,2)); WBUFW(buf, 0) = 0x3803; |