Skip to content

Commit f0d958d

Browse files
committed
Validate parameters to SDL_ReadStorageFile() and SDL_WriteStorageFile()
1 parent 6a1218c commit f0d958d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/storage/SDL_storage.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,9 @@ bool SDL_ReadStorageFile(SDL_Storage *storage, const char *path, void *destinati
251251
CHECK_PARAM(!ValidateStoragePath(path)) {
252252
return false;
253253
}
254+
CHECK_PARAM(length > 0 && !destination) {
255+
return SDL_InvalidParamError("destination");
256+
}
254257

255258
if (!storage->iface.read_file) {
256259
return SDL_Unsupported();
@@ -269,6 +272,9 @@ bool SDL_WriteStorageFile(SDL_Storage *storage, const char *path, const void *so
269272
CHECK_PARAM(!ValidateStoragePath(path)) {
270273
return false;
271274
}
275+
CHECK_PARAM(length > 0 && !source) {
276+
return SDL_InvalidParamError("source");
277+
}
272278

273279
if (!storage->iface.write_file) {
274280
return SDL_Unsupported();

0 commit comments

Comments
 (0)