summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-08-06 19:05:37 +0000
committerultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-08-06 19:05:37 +0000
commitaec807d9ba3c67308ac10cfe0de8d1a4568e9aaa (patch)
treef80a26aa0d80b10f4b0c95081edd072908c874f7 /src
parent6b459b8eeed83ca4c18782c85fa853993cc58731 (diff)
downloadhercules-aec807d9ba3c67308ac10cfe0de8d1a4568e9aaa.tar.gz
hercules-aec807d9ba3c67308ac10cfe0de8d1a4568e9aaa.tar.bz2
hercules-aec807d9ba3c67308ac10cfe0de8d1a4568e9aaa.tar.xz
hercules-aec807d9ba3c67308ac10cfe0de8d1a4568e9aaa.zip
* Added a null-pointer check to skill_initunit() to prevent a crash
* Added a while() loop to the client packet processor (for performance) * Added support for kRO 2007-05-14aSakexe langtype 0 login packet 0x2b0 * Added Job_Baby_Alchemist define to complement the Job_Alchemist update * Added custom Hollow Poring mob_db2 entry git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@10954 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r--src/login/login.c13
-rw-r--r--src/login_sql/login.c13
-rw-r--r--src/map/clif.c36
-rw-r--r--src/map/skill.c1
4 files changed, 42 insertions, 21 deletions
diff --git a/src/login/login.c b/src/login/login.c
index 5940571b9..e687ff986 100644
--- a/src/login/login.c
+++ b/src/login/login.c
@@ -3015,8 +3015,9 @@ int parse_login(int fd)
break;
case 0x0064: // request client login
- case 0x0277: // New login packet (layout is same as 0x64 but different length)
case 0x01dd: // request client login (encryption mode)
+ case 0x0277: // New login packet (layout is same as 0x64 but different length)
+ case 0x02b0: // New login packet (kRO 2007-05-14aSakexe langtype 0)
{
int packet_len = RFIFOREST(fd); // assume no other packet was sent
@@ -3033,14 +3034,16 @@ int parse_login(int fd)
break;
}
- if ((command == 0x0064 && packet_len < 55) ||
- (command == 0x0277 && packet_len < 84) ||
- (command == 0x01dd && packet_len < 47))
+ if( (command == 0x0064 && packet_len < 55)
+ || (command == 0x01dd && packet_len < 47)
+ || (command == 0x0277 && packet_len < 84)
+ || (command == 0x02b0 && packet_len < 85) )
return 0;
// S 0064 <version>.l <account name>.24B <password>.24B <version2>.B
- // S 0277 ??
// S 01dd <version>.l <account name>.24B <md5 binary>.16B <version2>.B
+ // S 0277 ??
+ // S 02b0 <version>.l <account name>.24B <password>.24B <?>.B <ip address>.16B <?>.13 <version2>.B
memset(&account, 0, sizeof(account));
account.version = RFIFOL(fd,2);
diff --git a/src/login_sql/login.c b/src/login_sql/login.c
index c8c9496ec..ecf09ae98 100644
--- a/src/login_sql/login.c
+++ b/src/login_sql/login.c
@@ -1345,8 +1345,9 @@ int parse_login(int fd)
break;
case 0x0064: // request client login
- case 0x0277: // New login packet (layout is same as 0x64 but different length)
case 0x01dd: // request client login (encryption mode)
+ case 0x0277: // New login packet (layout is same as 0x64 but different length)
+ case 0x02b0: // New login packet (kRO 2007-05-14aSakexe langtype 0)
{
int packet_len = RFIFOREST(fd);
@@ -1362,14 +1363,16 @@ int parse_login(int fd)
break;
}
- if ((command == 0x0064 && packet_len < 55) ||
- (command == 0x0277 && packet_len < 84) ||
- (command == 0x01dd && packet_len < 47))
+ if( (command == 0x0064 && packet_len < 55)
+ || (command == 0x01dd && packet_len < 47)
+ || (command == 0x0277 && packet_len < 84)
+ || (command == 0x02b0 && packet_len < 85) )
return 0;
// S 0064 <version>.l <account name>.24B <password>.24B <version2>.B
- // S 0277 ??
// S 01dd <version>.l <account name>.24B <md5 binary>.16B <version2>.B
+ // S 0277 ??
+ // S 02b0 <version>.l <account name>.24B <password>.24B <?>.B <ip address>.16B <?>.13 <version2>.B
memset(&account, 0, sizeof(account));
account.version = RFIFOL(fd,2);
diff --git a/src/map/clif.c b/src/map/clif.c
index 54632a3b5..6e96d79a4 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -7853,6 +7853,7 @@ void clif_feel_hate_reset(struct map_session_data *sd)
WFIFOSET(fd, packet_len(0x20e));
}
+
// ---------------------
// clif_guess_PacketVer
// ---------------------
@@ -11499,9 +11500,12 @@ void clif_parse_debug(int fd,struct map_session_data *sd)
*------------------------------------------*/
int clif_parse(int fd)
{
- int packet_len = 0, cmd, packet_ver, err;
+ int cmd, packet_ver, packet_len, err;
TBL_PC* sd;
+ while(1)
+ { // begin main client packet processing loop
+
sd = (TBL_PC *)session[fd]->session_data;
if (session[fd]->eof) {
if (sd) {
@@ -11651,6 +11655,8 @@ int clif_parse(int fd)
RFIFOSKIP(fd, packet_len);
+ }; // main loop end
+
return 0;
}
@@ -11667,7 +11673,7 @@ static int packetdb_readdb(void)
int skip_ver = 0;
int warned = 0;
char *str[64],*p,*str2[64],*p2,w1[64],w2[64];
- int packet_len_table[0x290] = {
+ int packet_len_table[MAX_PACKET_DB] = {
10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -11716,17 +11722,25 @@ static int packetdb_readdb(void)
30, 8, 34, 14, 2, 6, 26, 2, 28, 81, 6, 10, 26, 2, -1, -1,
-1, -1, 20, 10, 32, 9, 34, 14, 2, 6, 48, 56, -1, 4, 5, 10,
//#0x0200
- 26, -1, 26, 10, 18, 26, 11, 34, 14, 36, 10, 0, 0, -1, 32, 10, // 0x20c change to 0 (was 19)
- 22, 0, 26, 26, 42, 6, 6, 2, 2,282,282,10, 10, -1, -1, 66,
- 10, -1, -1, 8, 10, 2,282, 18, 18, 15, 58, 57, 64, 5, 71, 5,
- 12, 26, 9, 11, -1, -1, 10, 2, 282, 11, 4, 36, -1,-1, 4, 2,
+ 26, -1, 26, 10, 18, 26, 11, 34, 14, 36, 10, 0, 0, -1, 32, 10, // 0x20c change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, 0, 0, 0, 0, 0, 0,
};
struct {
void (*func)(int, struct map_session_data *);
diff --git a/src/map/skill.c b/src/map/skill.c
index 500df9aec..5e76f581f 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -9684,6 +9684,7 @@ struct skill_unit *skill_initunit (struct skill_unit_group *group, int idx, int
struct skill_unit *unit;
nullpo_retr(NULL, group);
+ nullpo_retr(NULL, group->unit); // crash-protection against poor coding
nullpo_retr(NULL, unit=&group->unit[idx]);
if(!unit->alive)