diff options
author | Amaury Pouly <amaury.pouly@gmail.com> | 2020-01-12 23:11:59 +0100 |
---|---|---|
committer | Amaury Pouly <amaury.pouly@gmail.com> | 2020-01-12 23:11:59 +0100 |
commit | 9e94a5eadcdbef406c22833b8afa9e380b698fdf (patch) | |
tree | 413522f043a757e6e6783619e05157523a9b7526 /utils/nwztools | |
parent | fbad4573390632c4d61b808bfc1ec91e4c62ff96 (diff) | |
download | rockbox-9e94a5eadcdbef406c22833b8afa9e380b698fdf.tar.gz rockbox-9e94a5eadcdbef406c22833b8afa9e380b698fdf.zip |
nwztools/scsitool: fix out of buffer access
Change-Id: Ib2c25dd21d39fda026e008950a805f032c916a72
Diffstat (limited to 'utils/nwztools')
-rw-r--r-- | utils/nwztools/scsitools/scsitool.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/utils/nwztools/scsitools/scsitool.c b/utils/nwztools/scsitools/scsitool.c index 27fa3c7cc1..22983a4f08 100644 --- a/utils/nwztools/scsitools/scsitool.c +++ b/utils/nwztools/scsitools/scsitool.c | |||
@@ -710,8 +710,8 @@ int get_dev_info(int argc, char **argv) | |||
710 | (void) argc; | 710 | (void) argc; |
711 | (void )argv; | 711 | (void )argv; |
712 | uint8_t cdb[12] = {0xfc, 0, 0x20, 'd', 'b', 'm', 'n', 0, 0x80, 0, 0, 0}; | 712 | uint8_t cdb[12] = {0xfc, 0, 0x20, 'd', 'b', 'm', 'n', 0, 0x80, 0, 0, 0}; |
713 | char buffer[80]; | 713 | char buffer[0x80]; |
714 | int buffer_size = 0x80; | 714 | int buffer_size = sizeof(buffer); |
715 | uint8_t sense[32]; | 715 | uint8_t sense[32]; |
716 | int sense_size = 32; | 716 | int sense_size = 32; |
717 | 717 | ||
@@ -724,7 +724,6 @@ int get_dev_info(int argc, char **argv) | |||
724 | cprintf(GREY, "An error occured during request\n"); | 724 | cprintf(GREY, "An error occured during request\n"); |
725 | return ret; | 725 | return ret; |
726 | } | 726 | } |
727 | buffer[buffer_size] = 0; | ||
728 | cprintf_field("Raw device info:", "\n"); | 727 | cprintf_field("Raw device info:", "\n"); |
729 | print_hex(buffer, buffer_size); | 728 | print_hex(buffer, buffer_size); |
730 | // the 16 first bytes are 'DEVINFO', 0x80, followed by zeroes | 729 | // the 16 first bytes are 'DEVINFO', 0x80, followed by zeroes |