Skip to content

Commit 15f64d9

Browse files
committed
Bound Clans member attribute encoding
1 parent 645458b commit 15f64d9

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

rpcs3/Emu/NP/clans_client.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -923,11 +923,14 @@ namespace clan
923923

924924
pugi::xml_node status = clan.append_child("bin-attr1"sv);
925925

926+
const u32 bin_data_size = static_cast<u32>(info.binData1Size);
927+
if (bin_data_size > sizeof(info.binAttr1))
928+
return SCE_NP_CLANS_ERROR_INVALID_ARGUMENT;
929+
926930
byte bin_attr_1[SCE_NP_CLANS_MEMBER_BINARY_ATTRIBUTE1_MAX_SIZE * 2 + 1] = {0};
927-
uint32_t bin_attr_1_size = UINT32_MAX;
928-
Base64_Encode_NoNl(info.binAttr1, info.binData1Size, bin_attr_1, &bin_attr_1_size);
931+
uint32_t bin_attr_1_size = sizeof(bin_attr_1);
929932

930-
if (bin_attr_1_size == UINT32_MAX)
933+
if (Base64_Encode_NoNl(info.binAttr1, bin_data_size, bin_attr_1, &bin_attr_1_size) != 0)
931934
return SCE_NP_CLANS_ERROR_INVALID_ARGUMENT;
932935

933936
// `reinterpret_cast` used to let the compiler select the correct overload of `set`

0 commit comments

Comments
 (0)