diff --git a/src/tape_drivers/freebsd/cam/cam_tc.c b/src/tape_drivers/freebsd/cam/cam_tc.c index 7c7f82bd..bfe785a2 100644 --- a/src/tape_drivers/freebsd/cam/cam_tc.c +++ b/src/tape_drivers/freebsd/cam/cam_tc.c @@ -281,7 +281,7 @@ int camtape_open(const char *devname, void **handle) /* Check the drive is supportable */ softc->vendor = get_vendor_id(vendor); struct supported_device **cur = get_supported_devs(softc->vendor); - while(*cur) { + while(cur && *cur) { if ((! strncmp((char*)softc->cd->inq_data.vendor, (*cur)->vendor_id, strlen((*cur)->vendor_id)) ) && (! strncmp((char*)softc->cd->inq_data.product, (*cur)->product_id, diff --git a/src/tape_drivers/linux/sg/sg_tape.c b/src/tape_drivers/linux/sg/sg_tape.c index 8a13493e..cd9b533a 100644 --- a/src/tape_drivers/linux/sg/sg_tape.c +++ b/src/tape_drivers/linux/sg/sg_tape.c @@ -500,7 +500,7 @@ static int _raw_open(struct sg_data *priv) priv->vendor = get_vendor_id(id_data.vendor_id); struct supported_device **cur = get_supported_devs(priv->vendor); - while(*cur) { + while(cur && *cur) { if((! strncmp(id_data.vendor_id, (*cur)->vendor_id, strlen((*cur)->vendor_id)) ) && (! strncmp(id_data.product_id, (*cur)->product_id, strlen((*cur)->product_id)) ) ) { drive_type = (*cur)->drive_type;