mirror of
https://gitlab.com/Mr_Goldberg/goldberg_emulator.git
synced 2024-11-23 12:28:07 +01:00
Add NULL pointer checks to remote storage interface.
This commit is contained in:
parent
b189fbf260
commit
f4cd015701
1 changed files with 6 additions and 2 deletions
|
@ -83,7 +83,7 @@ Steam_Remote_Storage(class Settings *settings, Local_Storage *local_storage, cla
|
|||
bool FileWrite( const char *pchFile, const void *pvData, int32 cubData )
|
||||
{
|
||||
PRINT_DEBUG("Steam_Remote_Storage::FileWrite %s %u\n", pchFile, cubData);
|
||||
if (!pchFile || cubData <= 0 || cubData > k_unMaxCloudFileChunkSize) {
|
||||
if (!pchFile || cubData <= 0 || cubData > k_unMaxCloudFileChunkSize || !pvData) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -96,6 +96,7 @@ bool FileWrite( const char *pchFile, const void *pvData, int32 cubData )
|
|||
int32 FileRead( const char *pchFile, void *pvData, int32 cubDataToRead )
|
||||
{
|
||||
PRINT_DEBUG("Steam_Remote_Storage::FileRead %s %i\n", pchFile, cubDataToRead);
|
||||
if (!pchFile || !pvData || !cubDataToRead) return 0;
|
||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||
int read_data = local_storage->get_data(Local_Storage::remote_storage_folder, pchFile, (char* )pvData, cubDataToRead);
|
||||
if (read_data < 0) read_data = 0;
|
||||
|
@ -107,7 +108,7 @@ STEAM_CALL_RESULT( RemoteStorageFileWriteAsyncComplete_t )
|
|||
SteamAPICall_t FileWriteAsync( const char *pchFile, const void *pvData, uint32 cubData )
|
||||
{
|
||||
PRINT_DEBUG("Steam_Remote_Storage::FileWriteAsync\n");
|
||||
if (!pchFile || cubData > k_unMaxCloudFileChunkSize || cubData == 0) {
|
||||
if (!pchFile || cubData > k_unMaxCloudFileChunkSize || cubData == 0 || !pvData) {
|
||||
return k_uAPICallInvalid;
|
||||
}
|
||||
|
||||
|
@ -124,6 +125,7 @@ STEAM_CALL_RESULT( RemoteStorageFileReadAsyncComplete_t )
|
|||
SteamAPICall_t FileReadAsync( const char *pchFile, uint32 nOffset, uint32 cubToRead )
|
||||
{
|
||||
PRINT_DEBUG("Steam_Remote_Storage::FileReadAsync\n");
|
||||
if (!pchFile) return k_uAPICallInvalid;
|
||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||
|
||||
unsigned int size = local_storage->file_size(Local_Storage::remote_storage_folder, pchFile);
|
||||
|
@ -151,6 +153,7 @@ SteamAPICall_t FileReadAsync( const char *pchFile, uint32 nOffset, uint32 cubToR
|
|||
bool FileReadAsyncComplete( SteamAPICall_t hReadCall, void *pvBuffer, uint32 cubToRead )
|
||||
{
|
||||
PRINT_DEBUG("Steam_Remote_Storage::FileReadAsyncComplete\n");
|
||||
if (!pvBuffer) return false;
|
||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||
|
||||
auto a_read = std::find_if(async_reads.begin(), async_reads.end(), [&hReadCall](Async_Read const& item) { return item.api_call == hReadCall; });
|
||||
|
@ -190,6 +193,7 @@ STEAM_CALL_RESULT( RemoteStorageFileShareResult_t )
|
|||
SteamAPICall_t FileShare( const char *pchFile )
|
||||
{
|
||||
PRINT_DEBUG("Steam_Remote_Storage::FileShare\n");
|
||||
if (!pchFile) return k_uAPICallInvalid;
|
||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||
RemoteStorageFileShareResult_t data = {};
|
||||
if (local_storage->file_exists(Local_Storage::remote_storage_folder, pchFile)) {
|
||||
|
|
Loading…
Reference in a new issue