Skip to content

Commit

Permalink
Merge pull request adafruit#54 from henrygab/patch-2
Browse files Browse the repository at this point in the history
Avoid returning uninitialized memory
  • Loading branch information
hathach authored Mar 13, 2019
2 parents 0eeff3e + 113195e commit 73456ac
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/usb/msc_uf2.c
Original file line number Diff line number Diff line change
Expand Up @@ -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] )
{
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 73456ac

Please sign in to comment.