Add validation to writes
parent
75dd582dec
commit
9508326732
|
@ -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 New Issue