diff --git a/dll/steam_remote_storage.h b/dll/steam_remote_storage.h index d0c7646..2840abb 100644 --- a/dll/steam_remote_storage.h +++ b/dll/steam_remote_storage.h @@ -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 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 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)); }