diff options
author | André Fabian Silva Delgado <emulatorman@parabola.nu> | 2015-09-08 01:01:14 -0300 |
---|---|---|
committer | André Fabian Silva Delgado <emulatorman@parabola.nu> | 2015-09-08 01:01:14 -0300 |
commit | e5fd91f1ef340da553f7a79da9540c3db711c937 (patch) | |
tree | b11842027dc6641da63f4bcc524f8678263304a3 /drivers/staging/ozwpan/ozusbsvc1.c | |
parent | 2a9b0348e685a63d97486f6749622b61e9e3292f (diff) |
Linux-libre 4.2-gnu
Diffstat (limited to 'drivers/staging/ozwpan/ozusbsvc1.c')
-rw-r--r-- | drivers/staging/ozwpan/ozusbsvc1.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/staging/ozwpan/ozusbsvc1.c b/drivers/staging/ozwpan/ozusbsvc1.c index f660bb198..301fee862 100644 --- a/drivers/staging/ozwpan/ozusbsvc1.c +++ b/drivers/staging/ozwpan/ozusbsvc1.c @@ -342,12 +342,16 @@ static void oz_usb_handle_ep_data(struct oz_usb_ctx *usb_ctx, case OZ_DATA_F_ISOC_FIXED: { struct oz_isoc_fixed *body = (struct oz_isoc_fixed *)data_hdr; - int data_len = len-sizeof(struct oz_isoc_fixed)+1; + int data_len; int unit_size = body->unit_size; u8 *data = body->data; int count; int i; + if (len < sizeof(struct oz_isoc_fixed) - 1) + break; + data_len = len - (sizeof(struct oz_isoc_fixed) - 1); + if (!unit_size) break; count = data_len/unit_size; @@ -427,6 +431,11 @@ void oz_usb_rx(struct oz_pd *pd, struct oz_elt *elt) case OZ_VENDOR_CLASS_RSP: { struct oz_vendor_class_rsp *body = (struct oz_vendor_class_rsp *)usb_hdr; + + if (elt->length < + sizeof(struct oz_vendor_class_rsp) - 1) + break; + oz_hcd_control_cnf(usb_ctx->hport, body->req_id, body->rcode, body->data, elt->length- sizeof(struct oz_vendor_class_rsp)+1); |