mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-30 19:11:31 +00:00
Crash fix for trying to write a 0 length packet to another packet.
This commit is contained in:
parent
a834ec92a5
commit
cfd7e9f4d3
@ -139,6 +139,10 @@ void EQ::Net::Packet::PutCString(size_t offset, const char *str)
|
||||
|
||||
void EQ::Net::Packet::PutPacket(size_t offset, const Packet &p)
|
||||
{
|
||||
if (p.Length() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (Length() < offset + p.Length()) {
|
||||
if (!Resize(offset + p.Length())) {
|
||||
throw std::out_of_range("Packet::PutPacket(), could not resize packet and would of written past the end.");
|
||||
@ -150,6 +154,10 @@ void EQ::Net::Packet::PutPacket(size_t offset, const Packet &p)
|
||||
|
||||
void EQ::Net::Packet::PutData(size_t offset, void *data, size_t length)
|
||||
{
|
||||
if (length == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (Length() < offset + length) {
|
||||
if (!Resize(offset + length)) {
|
||||
throw std::out_of_range("Packet::PutData(), could not resize packet and would of written past the end.");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user