+ Gump ButtonID response validation.
* Dispose of NetStates that attempt to send a gump response with a ButtonID not defined by the Gump.
This commit is contained in:
parent
e47753df2b
commit
527550e667
1 changed files with 27 additions and 0 deletions
|
|
@ -1245,6 +1245,33 @@ namespace Server.Network
|
|||
|
||||
foreach ( Gump gump in state.Gumps ) {
|
||||
if ( gump.Serial == serial && gump.TypeID == typeID ) {
|
||||
var buttonExists = buttonID == 0; // 0 is always 'close'
|
||||
|
||||
if (!buttonExists)
|
||||
{
|
||||
foreach (var e in gump.Entries)
|
||||
{
|
||||
if (e is GumpButton && ((GumpButton)e).ButtonID == buttonID)
|
||||
{
|
||||
buttonExists = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (e is GumpImageTileButton && ((GumpImageTileButton)e).ButtonID == buttonID)
|
||||
{
|
||||
buttonExists = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!buttonExists)
|
||||
{
|
||||
state.WriteConsole("Invalid gump response, disconnecting...");
|
||||
state.Dispose();
|
||||
return;
|
||||
}
|
||||
|
||||
int switchCount = pvSrc.ReadInt32();
|
||||
|
||||
if ( switchCount < 0 || switchCount > gump.m_Switches ) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue