Fixed a crash with unknown packets (#8437)
Fixes #8432 Thanks to @gmragnarok
This commit is contained in:
parent
6451925430
commit
68f8a4bc7f
@ -1594,19 +1594,27 @@ int chclif_parse(int fd) {
|
||||
|
||||
// Before processing any other packets, do a few checks
|
||||
default:
|
||||
// If the pincode was entered correctly
|
||||
if( sd->pincode_correct ){
|
||||
break;
|
||||
}
|
||||
// To reach this block the client should have attained a session already
|
||||
if( sd != nullptr ){
|
||||
// If the pincode was entered correctly
|
||||
if( sd->pincode_correct ){
|
||||
break;
|
||||
}
|
||||
|
||||
// If no pincode is set (yet)
|
||||
if( strlen( sd->pincode ) <= 0 ){
|
||||
break;
|
||||
}
|
||||
// If no pincode is set (yet)
|
||||
if( strlen( sd->pincode ) <= 0 ){
|
||||
break;
|
||||
}
|
||||
|
||||
// The pincode was not entered correctly, yet the player (=bot) tried to send a different packet => Goodbye!
|
||||
set_eof( fd );
|
||||
return 0;
|
||||
// The pincode was not entered correctly, yet the player (=bot) tried to send a different packet => Goodbye!
|
||||
set_eof( fd );
|
||||
return 0;
|
||||
}else{
|
||||
// Unknown packet received
|
||||
ShowError( "chclif_parse: Received unknown packet " CL_WHITE "0x%x" CL_RESET " from ip '" CL_WHITE "%s" CL_RESET "'! Disconnecting!\n", cmd, ip2str( ipl, nullptr ) );
|
||||
set_eof( fd );
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -1654,7 +1662,7 @@ int chclif_parse(int fd) {
|
||||
break;
|
||||
// unknown packet received
|
||||
default:
|
||||
ShowError("parse_char: Received unknown packet " CL_WHITE "0x%x" CL_RESET " from ip '" CL_WHITE "%s" CL_RESET "'! Disconnecting!\n", RFIFOW(fd,0), ip2str(ipl, nullptr));
|
||||
ShowError( "chclif_parse: Received unknown packet " CL_WHITE "0x%x" CL_RESET " from ip '" CL_WHITE "%s" CL_RESET "'! Disconnecting!\n", cmd, ip2str( ipl, nullptr ) );
|
||||
set_eof(fd);
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user