Skip to content

Commit

Permalink
Fix returning data from virtual tape when the output is bigger than t…
Browse files Browse the repository at this point in the history
…he tape block

Trivial to reproduce the bug - write a block to the virtual tape, then
read it back with a blocksize bigger than the original data but less
than 2x the original size. The data will be corrupted.
  • Loading branch information
Tim Woodall committed Nov 16, 2024
1 parent 0b080d7 commit c7011f2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion usr/bs_ssc.c
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ static int resp_var_read(struct scsi_cmd *cmd, uint8_t *buf, uint32_t length,
info, sizeof(info));

if (length > h->blk_sz)
scsi_set_in_resid_by_actual(cmd, length - h->blk_sz);
scsi_set_in_resid_by_actual(cmd, h->blk_sz);
else
scsi_set_in_resid_by_actual(cmd, 0);

Expand Down

0 comments on commit c7011f2

Please sign in to comment.