Avoid returning uninitialized memory

This commit is contained in:
Henry Gabryjelski 2019-03-12 12:57:51 -07:00
parent 4ea74d4600
commit a258c6d988

View File

@ -64,6 +64,7 @@ int32_t tud_msc_scsi_cb (uint8_t lun, uint8_t const scsi_cmd[16], void* buffer,
{ {
void const* response = NULL; void const* response = NULL;
uint16_t resplen = 0; uint16_t resplen = 0;
memset(buffer, 0, bufsize);
switch ( scsi_cmd[0] ) switch ( scsi_cmd[0] )
{ {
@ -114,6 +115,7 @@ int32_t tud_msc_scsi_cb (uint8_t lun, uint8_t const scsi_cmd[16], void* buffer,
int32_t tud_msc_read10_cb (uint8_t lun, uint32_t lba, uint32_t offset, void* buffer, uint32_t bufsize) int32_t tud_msc_read10_cb (uint8_t lun, uint32_t lba, uint32_t offset, void* buffer, uint32_t bufsize)
{ {
(void) lun; (void) lun;
memset(buffer, 0, bufsize);
// since we return block size each, offset should always be zero // since we return block size each, offset should always be zero
TU_ASSERT(offset == 0, -1); TU_ASSERT(offset == 0, -1);