Merge pull request #54 from henrygab/patch-2

Avoid returning uninitialized memory
This commit is contained in:
hathach 2019-03-13 01:08:06 -07:00 committed by GitHub
commit 73456ac80e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

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;
int32_t resplen = 0;
memset(buffer, 0, bufsize);
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)
{
(void) lun;
memset(buffer, 0, bufsize);
// since we return block size each, offset should always be zero
TU_ASSERT(offset == 0, -1);