Look for a NULL destination buffer in mmc_read_cd and return

DRIVER_OP_BAD_POINTER in this particular situation.
This commit is contained in:
R. Bernstein
2011-11-27 17:47:50 -05:00
parent 0c5e4efbe1
commit c242ca3997
2 changed files with 22 additions and 4 deletions

View File

@@ -296,7 +296,10 @@ mmc_read_cd(const CdIo_t *p_cdio, void *p_buf1, lsn_t i_lsn,
void *p_buf = p_buf1;
uint8_t cdb9 = 0;
const unsigned int i_timeout = mmc_timeout_ms * (MAX_CD_READ_BLOCKS/2);
/* Catch what may be a common bug. */
if (NULL == p_buf) return DRIVER_OP_BAD_POINTER;
MMC_CMD_SETUP(CDIO_MMC_GPCMD_READ_CD);
CDIO_MMC_SET_READ_TYPE(cdb.field, read_sector_type);