Skip to content

Commit

Permalink
usb: check USB configuration descriptor object
Browse files Browse the repository at this point in the history
When processing remote NDIS control message packets, the USB Net
device emulator checks to see if the USB configuration descriptor
object is of RNDIS type(2). But it does not check if it is null,
which leads to a null dereference error. Add check to avoid it.

Reported-by: Qinghao Tang <[email protected]>
Signed-off-by: Prasad J Pandit <[email protected]>
Message-id: [email protected]
Signed-off-by: Gerd Hoffmann <[email protected]>
  • Loading branch information
Prasad J Pandit authored and kraxel committed Feb 23, 2016
1 parent 8eb779e commit 80eecda
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion hw/usb/dev-network.c
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,8 @@ typedef struct USBNetState {

static int is_rndis(USBNetState *s)
{
return s->dev.config->bConfigurationValue == DEV_RNDIS_CONFIG_VALUE;
return s->dev.config ?
s->dev.config->bConfigurationValue == DEV_RNDIS_CONFIG_VALUE : 0;
}

static int ndis_query(USBNetState *s, uint32_t oid,
Expand Down

0 comments on commit 80eecda

Please sign in to comment.