mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-11 15:58:36 +00:00
Use strn0cpy instead of strcpy when copying consent name buffers
Add nullptr checks to consent functions that accept char pointers
This commit is contained in:
+7
-4
@@ -6257,7 +6257,10 @@ void Client::DragCorpses()
|
||||
|
||||
void Client::ConsentCorpses(const char* consent_name, bool deny)
|
||||
{
|
||||
if (strcasecmp(consent_name, GetName()) == 0) {
|
||||
if (!consent_name) {
|
||||
return;
|
||||
}
|
||||
else if (strcasecmp(consent_name, GetName()) == 0) {
|
||||
MessageString(Chat::Red, CONSENT_YOURSELF);
|
||||
}
|
||||
else if (!consent_throttle_timer.Check()) {
|
||||
@@ -6266,9 +6269,9 @@ void Client::ConsentCorpses(const char* consent_name, bool deny)
|
||||
else {
|
||||
auto pack = new ServerPacket(ServerOP_Consent, sizeof(ServerOP_Consent_Struct));
|
||||
ServerOP_Consent_Struct* scs = (ServerOP_Consent_Struct*)pack->pBuffer;
|
||||
strcpy(scs->grantname, consent_name);
|
||||
strcpy(scs->ownername, GetName());
|
||||
strcpy(scs->zonename, "Unknown");
|
||||
strn0cpy(scs->grantname, consent_name, sizeof(scs->grantname));
|
||||
strn0cpy(scs->ownername, GetName(), sizeof(scs->ownername));
|
||||
strn0cpy(scs->zonename, "Unknown", sizeof(scs->zonename));
|
||||
scs->message_string_id = 0;
|
||||
scs->permission = deny ? 0 : 1;
|
||||
scs->zone_id = zone->GetZoneID();
|
||||
|
||||
Reference in New Issue
Block a user