From f0d958d850144ae87b90d4631a4eb957088137cc Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 22 Nov 2025 18:41:03 -0800 Subject: [PATCH] Validate parameters to SDL_ReadStorageFile() and SDL_WriteStorageFile() --- src/storage/SDL_storage.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/storage/SDL_storage.c b/src/storage/SDL_storage.c index ce95552a04..b7fca7557c 100644 --- a/src/storage/SDL_storage.c +++ b/src/storage/SDL_storage.c @@ -251,6 +251,9 @@ bool SDL_ReadStorageFile(SDL_Storage *storage, const char *path, void *destinati CHECK_PARAM(!ValidateStoragePath(path)) { return false; } + CHECK_PARAM(length > 0 && !destination) { + return SDL_InvalidParamError("destination"); + } if (!storage->iface.read_file) { return SDL_Unsupported(); @@ -269,6 +272,9 @@ bool SDL_WriteStorageFile(SDL_Storage *storage, const char *path, const void *so CHECK_PARAM(!ValidateStoragePath(path)) { return false; } + CHECK_PARAM(length > 0 && !source) { + return SDL_InvalidParamError("source"); + } if (!storage->iface.write_file) { return SDL_Unsupported();