Skip to content

Commit

Permalink
Fix null pointer bug on non nk3
Browse files Browse the repository at this point in the history
  • Loading branch information
sosthene-nitrokey committed Dec 9, 2024
1 parent 12ba32e commit 0bbc6ea
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/operations_ccid.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@
int nk3_reset(struct Device *dev, const char * new_pin) {
libusb_device *usb_dev;
struct libusb_device_descriptor usb_desc;

if (!dev->mp_devhandle_ccid) {
// Not an NK3
return RET_NO_ERROR;
}

usb_dev = libusb_get_device(dev->mp_devhandle_ccid);

int r = libusb_get_device_descriptor(usb_dev, &usb_desc);
Expand All @@ -46,7 +52,7 @@ int nk3_reset(struct Device *dev, const char * new_pin) {


if (usb_desc.idVendor != NITROKEY_USB_VID || usb_desc.idProduct != NITROKEY_3_USB_PID) {
return 0;
return RET_NO_ERROR;
}


Expand Down

0 comments on commit 0bbc6ea

Please sign in to comment.