From 202a316f810b700dcdba9aa95532fa3ce842b303 Mon Sep 17 00:00:00 2001 From: straps-eq Date: Wed, 18 Nov 2026 01:26:00 -0600 Subject: [PATCH] [Bug Fix] Bound the barter welcome message and don't use it as a format string (#5141) --- zone/client_packet.cpp | 5 +++++ zone/trading.cpp | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 873e88c00..85615d3a5 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -3798,7 +3798,12 @@ void Client::Handle_OP_Barter(const EQApplicationPacket *app) } case Barter_WelcomeMessageUpdate: { + if (app->size < sizeof(BuyerWelcomeMessageUpdate_Struct)) { + break; + } + auto bwmu = (BuyerWelcomeMessageUpdate_Struct *) app->pBuffer; + bwmu->welcome_message[sizeof(bwmu->welcome_message) - 1] = '\0'; SetBuyerWelcomeMessage(bwmu->welcome_message); break; } diff --git a/zone/trading.cpp b/zone/trading.cpp index 4b79a8399..ac34ed4e7 100644 --- a/zone/trading.cpp +++ b/zone/trading.cpp @@ -3130,7 +3130,7 @@ void Client::SendBuyerGreeting(uint32 buyer_id) Message(Chat::White, "Welcome!"); return; } - Message(Chat::White, buyer.front().welcome_message.c_str()); + Message(Chat::White, "%s", buyer.front().welcome_message.c_str()); } void Client::SendSellerBrowsing(const std::string &browser)