mirror of
https://github.com/mm201/pkmn-classic-framework.git
synced 2026-04-25 16:20:08 -05:00
Added some extra validation to the _finish.asp series of requests.
This commit is contained in:
parent
06f9c04053
commit
9fc5459c66
|
|
@ -309,8 +309,18 @@ namespace PkmnFoundations.GTS
|
|||
|
||||
// find a matching session which contains our record
|
||||
GtsSession4 prevSession = manager.FindSession4(pid, "/worldexchange/post.asp");
|
||||
if (prevSession == null)
|
||||
{
|
||||
response.Write(new byte[] { 0x00, 0x00 }, 0, 2);
|
||||
return;
|
||||
}
|
||||
|
||||
manager.Remove(prevSession);
|
||||
if (prevSession.Tag == null)
|
||||
{
|
||||
response.Write(new byte[] { 0x00, 0x00 }, 0, 2);
|
||||
return;
|
||||
}
|
||||
AssertHelper.Assert(prevSession.Tag is GtsRecord4);
|
||||
GtsRecord4 record = (GtsRecord4)prevSession.Tag;
|
||||
|
||||
|
|
@ -437,8 +447,18 @@ namespace PkmnFoundations.GTS
|
|||
|
||||
// find a matching session which contains our record
|
||||
GtsSession4 prevSession = manager.FindSession4(pid, "/worldexchange/exchange.asp");
|
||||
if (prevSession == null)
|
||||
{
|
||||
response.Write(new byte[] { 0x00, 0x00 }, 0, 2);
|
||||
return;
|
||||
}
|
||||
|
||||
manager.Remove(prevSession);
|
||||
if (prevSession.Tag == null)
|
||||
{
|
||||
response.Write(new byte[] { 0x00, 0x00 }, 0, 2);
|
||||
return;
|
||||
}
|
||||
AssertHelper.Assert(prevSession.Tag is GtsRecord4[]);
|
||||
GtsRecord4[] tag = (GtsRecord4[])prevSession.Tag;
|
||||
AssertHelper.Assert(tag.Length == 2);
|
||||
|
|
@ -474,7 +494,7 @@ namespace PkmnFoundations.GTS
|
|||
{
|
||||
get
|
||||
{
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -313,8 +313,18 @@ namespace PkmnFoundations.GTS
|
|||
|
||||
// find a matching session which contains our record
|
||||
GtsSession5 prevSession = manager.FindSession5(pid, "/worldexchange/post.asp");
|
||||
if (prevSession == null)
|
||||
{
|
||||
response.Write(new byte[] { 0x00, 0x00 }, 0, 2);
|
||||
return;
|
||||
}
|
||||
|
||||
manager.Remove(prevSession);
|
||||
if (prevSession.Tag == null)
|
||||
{
|
||||
response.Write(new byte[] { 0x00, 0x00 }, 0, 2);
|
||||
return;
|
||||
}
|
||||
AssertHelper.Assert(prevSession.Tag is GtsRecord5);
|
||||
GtsRecord5 record = (GtsRecord5)prevSession.Tag;
|
||||
|
||||
|
|
@ -438,8 +448,18 @@ namespace PkmnFoundations.GTS
|
|||
|
||||
// find a matching session which contains our record
|
||||
GtsSession5 prevSession = manager.FindSession5(pid, "/worldexchange/exchange.asp");
|
||||
if (prevSession == null)
|
||||
{
|
||||
response.Write(new byte[] { 0x00, 0x00 }, 0, 2);
|
||||
return;
|
||||
}
|
||||
|
||||
manager.Remove(prevSession);
|
||||
if (prevSession.Tag == null)
|
||||
{
|
||||
response.Write(new byte[] { 0x00, 0x00 }, 0, 2);
|
||||
return;
|
||||
}
|
||||
AssertHelper.Assert(prevSession.Tag is GtsRecord5[]);
|
||||
GtsRecord5[] tag = (GtsRecord5[])prevSession.Tag;
|
||||
AssertHelper.Assert(tag.Length == 2);
|
||||
|
|
@ -482,7 +502,7 @@ namespace PkmnFoundations.GTS
|
|||
{
|
||||
get
|
||||
{
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -410,6 +410,7 @@ namespace PkmnFoundations.Data
|
|||
|
||||
public bool GtsDepositPokemon5(MySqlTransaction tran, GtsRecord5 record)
|
||||
{
|
||||
if (record == null) throw new ArgumentNullException("record");
|
||||
if (record.Data.Length != 220) throw new FormatException("pkm data must be 220 bytes.");
|
||||
if (record.Unknown0.Length != 16) throw new FormatException("pkm padding must be 16 bytes.");
|
||||
if (record.TrainerName.RawData.Length != 16) throw new FormatException("Trainer name must be 16 bytes.");
|
||||
|
|
@ -444,6 +445,7 @@ namespace PkmnFoundations.Data
|
|||
|
||||
public override bool GtsDepositPokemon5(GtsRecord5 record)
|
||||
{
|
||||
if (record == null) throw new ArgumentNullException("record");
|
||||
if (record.Data.Length != 220) throw new FormatException("pkm data must be 220 bytes.");
|
||||
if (record.Unknown0.Length != 16) throw new FormatException("pkm padding must be 16 bytes.");
|
||||
if (record.TrainerName.RawData.Length != 16) throw new FormatException("Trainer name must be 16 bytes.");
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user