mirror of
https://gitlab.com/Mr_Goldberg/goldberg_emulator.git
synced 2024-11-23 20:38:07 +01:00
Add validation to writes
This commit is contained in:
parent
75dd582dec
commit
9508326732
1 changed files with 12 additions and 1 deletions
|
@ -84,6 +84,11 @@ bool FileWrite( const char *pchFile, const void *pvData, int32 cubData )
|
|||
{
|
||||
PRINT_DEBUG("Steam_Remote_Storage::FileWrite %s %u\n", pchFile, cubData);
|
||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||
|
||||
if (!pvData || cubData < 0 || cubData > k_unMaxCloudFileChunkSize) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int data_stored = local_storage->store_data(REMOTE_STORAGE_FOLDER, pchFile, (char* )pvData, cubData);
|
||||
PRINT_DEBUG("Steam_Remote_Storage::Stored %i, %u\n", data_stored, data_stored == cubData);
|
||||
return data_stored == cubData;
|
||||
|
@ -104,9 +109,15 @@ SteamAPICall_t FileWriteAsync( const char *pchFile, const void *pvData, uint32 c
|
|||
{
|
||||
PRINT_DEBUG("Steam_Remote_Storage::FileWriteAsync\n");
|
||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||
|
||||
if (!pvData || cubData > k_unMaxCloudFileChunkSize) {
|
||||
return k_uAPICallInvalid;
|
||||
}
|
||||
|
||||
bool success = local_storage->store_data(REMOTE_STORAGE_FOLDER, pchFile, (char* )pvData, cubData) == cubData;
|
||||
|
||||
RemoteStorageFileWriteAsyncComplete_t data;
|
||||
data.m_eResult = k_EResultOK;
|
||||
data.m_eResult = success ? k_EResultOK : k_EResultFail;
|
||||
|
||||
return callback_results->addCallResult(data.k_iCallback, &data, sizeof(data));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue