aboutsummaryrefslogtreecommitdiff
path: root/libpsn00b/psxcd/cdread.c
diff options
context:
space:
mode:
authorspicyjpeg <thatspicyjpeg@gmail.com>2023-04-04 15:09:38 +0200
committerspicyjpeg <thatspicyjpeg@gmail.com>2023-04-04 15:09:38 +0200
commit870f4dca9d7b5e86544216d0e36863d17aefef62 (patch)
treef6186004da976cea19ee5764b795a51f932f77fb /libpsn00b/psxcd/cdread.c
parentf7d9c309661f3027d5bfd119b3daf814e26ef589 (diff)
downloadpsn00bsdk-870f4dca9d7b5e86544216d0e36863d17aefef62.tar.gz
Add argument validation to most libpsn00b functions
Diffstat (limited to 'libpsn00b/psxcd/cdread.c')
-rw-r--r--libpsn00b/psxcd/cdread.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libpsn00b/psxcd/cdread.c b/libpsn00b/psxcd/cdread.c
index d211a01..1adc255 100644
--- a/libpsn00b/psxcd/cdread.c
+++ b/libpsn00b/psxcd/cdread.c
@@ -89,6 +89,8 @@ static int _poll_retry(void) {
/* Public API */
int CdReadRetry(int sectors, uint32_t *buf, int mode, int attempts) {
+ _sdk_validate_args((sectors > 0) && buf && (attempts > 0), -1);
+
if (CdReadSync(1, 0) > 0) {
_sdk_log("CdRead() failed, another read in progress (%d sectors pending)\n", _pending_sectors);
return 0;