mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-29 14:38:29 +00:00
Fix stack address escape in SDL_CameraDevicePermissionOutcome()
If allocation of 'p' fails, 'pending_tail' points to 'pending'.
This commit is contained in:

committed by
Sam Lantinga

parent
c226630086
commit
43c2b42517
@@ -599,6 +599,7 @@ void SDL_CameraDevicePermissionOutcome(SDL_CameraDevice *device, SDL_bool approv
|
|||||||
|
|
||||||
ReleaseCameraDevice(device);
|
ReleaseCameraDevice(device);
|
||||||
|
|
||||||
|
if (pending.next) { // NULL if event is disabled or disaster struck.
|
||||||
SDL_LockRWLockForWriting(camera_driver.device_hash_lock);
|
SDL_LockRWLockForWriting(camera_driver.device_hash_lock);
|
||||||
SDL_assert(camera_driver.pending_events_tail != NULL);
|
SDL_assert(camera_driver.pending_events_tail != NULL);
|
||||||
SDL_assert(camera_driver.pending_events_tail->next == NULL);
|
SDL_assert(camera_driver.pending_events_tail->next == NULL);
|
||||||
@@ -606,6 +607,7 @@ void SDL_CameraDevicePermissionOutcome(SDL_CameraDevice *device, SDL_bool approv
|
|||||||
camera_driver.pending_events_tail = pending_tail;
|
camera_driver.pending_events_tail = pending_tail;
|
||||||
SDL_UnlockRWLock(camera_driver.device_hash_lock);
|
SDL_UnlockRWLock(camera_driver.device_hash_lock);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
SDL_CameraDevice *SDL_FindPhysicalCameraDeviceByCallback(SDL_bool (*callback)(SDL_CameraDevice *device, void *userdata), void *userdata)
|
SDL_CameraDevice *SDL_FindPhysicalCameraDeviceByCallback(SDL_bool (*callback)(SDL_CameraDevice *device, void *userdata), void *userdata)
|
||||||
|
Reference in New Issue
Block a user