Skip to content

Commit 73456ac

Browse files
authored
Merge pull request #54 from henrygab/patch-2
Avoid returning uninitialized memory
2 parents 0eeff3e + 113195e commit 73456ac

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/usb/msc_uf2.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ int32_t tud_msc_scsi_cb (uint8_t lun, uint8_t const scsi_cmd[16], void* buffer,
6464
{
6565
void const* response = NULL;
6666
int32_t resplen = 0;
67+
memset(buffer, 0, bufsize);
6768

6869
switch ( scsi_cmd[0] )
6970
{
@@ -114,6 +115,7 @@ int32_t tud_msc_scsi_cb (uint8_t lun, uint8_t const scsi_cmd[16], void* buffer,
114115
int32_t tud_msc_read10_cb (uint8_t lun, uint32_t lba, uint32_t offset, void* buffer, uint32_t bufsize)
115116
{
116117
(void) lun;
118+
memset(buffer, 0, bufsize);
117119

118120
// since we return block size each, offset should always be zero
119121
TU_ASSERT(offset == 0, -1);

0 commit comments

Comments
 (0)