isdn: hfc_usb: Fix read buffer overflow
authorRoel Kluin <[email protected]>
Wed, 4 Nov 2009 16:31:59 +0000 (08:31 -0800)
committerDavid S. Miller <[email protected]>
Wed, 4 Nov 2009 16:31:59 +0000 (08:31 -0800)
Check whether index is within bounds before testing the element.

Signed-off-by: Roel Kluin <[email protected]>
Cc: Karsten Keil <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
drivers/isdn/hisax/hfc_usb.c

index 9de54202c90c84828c86cefeeb3408b090ea0bdc..a420b64472e3229618bbd03b0edcf5c60227481d 100644 (file)
@@ -817,8 +817,8 @@ collect_rx_frame(usb_fifo * fifo, __u8 * data, int len, int finish)
        }
        /* we have a complete hdlc packet */
        if (finish) {
-               if ((!fifo->skbuff->data[fifo->skbuff->len - 1])
-                   && (fifo->skbuff->len > 3)) {
+               if (fifo->skbuff->len > 3 &&
+                               !fifo->skbuff->data[fifo->skbuff->len - 1]) {
 
                        if (fifon == HFCUSB_D_RX) {
                                DBG(HFCUSB_DBG_DCHANNEL,