Sean Anderson
24057fe0a8
sandbox: usb: Fix out-of-bounds read when fd=-1
...
sandbox_flash_bulk uses priv->read_len to determine if priv->buff contains
the response data (such as from SCSI_INQUIRY). However, if priv->fd=-1 in
handle_read, then priv->read_len is not set even though we are going to
PHASE_DATA. This causes sandbox_flash_bulk to try and read len bytes from
priv->buff, which likely goes past the end of the buffer. Fix this by always
setting priv->read_len even if we aren't going to read anything.
Fixes: f4f715360c ("dm: usb: sandbox: Add an emulator for USB flash devices")
Signed-off-by: Sean Anderson <seanga2@gmail.com >
Reviewed-by: Simon Glass <sjg@chromium.org >
2022-06-28 03:09:51 +01:00
..
2022-04-25 09:25:00 +02:00
2022-05-03 18:33:29 -04:00
2021-09-30 08:08:56 -04:00
2022-05-03 18:33:29 -04:00
2022-05-02 09:58:13 -04:00
2022-03-28 12:36:49 -04:00
2021-03-22 19:23:27 +13:00
2022-02-11 09:00:47 -05:00
2022-06-17 16:27:05 +08:00
2022-06-23 13:12:55 -04:00
2022-06-27 10:15:50 -04:00
2022-06-24 14:16:00 +02:00
2022-06-22 21:30:05 -04:00
2022-06-20 14:40:59 -04:00
2021-10-05 08:50:15 -04:00
2022-02-11 11:29:23 -05:00
2022-06-10 13:37:32 -04:00
2022-01-28 11:30:39 -05:00
2022-06-27 10:15:50 -04:00
2021-12-17 12:58:01 +08:00
2022-06-23 12:58:19 -04:00
2022-05-23 11:37:58 +02:00
2022-01-13 07:57:49 -05:00
2022-06-20 14:40:59 -04:00
2022-02-10 16:44:23 -05:00
2022-02-21 08:35:40 -05:00
2022-04-28 09:26:44 -04:00
2022-02-10 16:44:23 -05:00
2021-09-27 21:38:34 -04:00
2022-06-22 21:30:05 -04:00
2022-06-20 14:40:59 -04:00
2022-06-20 08:09:24 -04:00
2022-01-13 07:57:49 -05:00
2022-06-27 10:15:50 -04:00
2022-05-03 18:33:29 -04:00
2021-09-25 09:46:15 -06:00
2022-06-20 14:40:59 -04:00
2021-07-06 10:38:03 -06:00
2022-05-18 13:17:54 +02:00
2022-06-27 10:15:50 -04:00
2022-06-23 13:12:56 -04:00
2022-04-12 19:10:44 +02:00
2021-11-09 17:18:23 +05:30
2022-06-17 10:41:16 +02:00
2021-10-05 08:50:15 -04:00
2022-02-08 11:00:03 -05:00
2022-06-23 13:12:55 -04:00
2022-06-23 13:12:56 -04:00
2022-06-08 14:00:22 -04:00
2022-04-09 21:06:31 +02:00
2022-06-27 10:15:50 -04:00
2021-07-06 10:38:03 -06:00
2022-06-27 10:15:50 -04:00
2022-04-29 11:11:36 -04:00
2022-06-22 21:30:05 -04:00
2021-10-31 08:46:44 -04:00
2021-07-20 23:33:54 +02:00
2022-05-02 09:58:13 -04:00
2022-06-06 18:01:21 -04:00
2021-09-30 09:08:16 -04:00
2022-06-27 10:15:50 -04:00
2022-05-23 16:33:58 +03:00
2022-05-03 21:39:22 +02:00
2022-06-28 03:09:51 +01:00
2022-06-13 15:31:10 -07:00
2022-06-08 09:24:04 -04:00
2021-10-01 21:08:18 -04:00
2021-07-06 10:38:03 -06:00
2022-05-06 07:06:51 +02:00
2021-09-30 08:08:56 -04:00
2022-06-23 12:58:18 -04:00
2022-06-23 12:58:18 -04:00