提交 6b1de148 编写于 作者: P Philippe Mathieu-Daudé 提交者: Michael Tokarev

usb-ccid: make ccid_write_data_block() cope with null buffers

static code analyzer complain:

hw/usb/dev-smartcard-reader.c:816:5: warning: Null pointer passed as an argument to a 'nonnull' parameter
    memcpy(p->abData, data, len);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~

Reported-by: Clang Static Analyzer
Signed-off-by: NPhilippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: NMichael Tokarev <mjt@tls.msk.ru>
上级 46bbbec2
......@@ -813,7 +813,10 @@ static void ccid_write_data_block(USBCCIDState *s, uint8_t slot, uint8_t seq,
if (p->b.bError) {
DPRINTF(s, D_VERBOSE, "error %d\n", p->b.bError);
}
if (len) {
g_assert_nonnull(data);
memcpy(p->abData, data, len);
}
ccid_reset_error_status(s);
usb_wakeup(s->bulk, 0);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册