struct candevice_t* register_usbdev(const char *hwname,void *anydev){
- int i=0, j, board;
+ int i=0, j, board=0;
struct candevice_t *candev;
struct canchip_t *chip;
struct boardtype_t *brp;
while ( (hw[board] != NULL) && (board < MAX_HW_CARDS) )
board++;
+ if (board>=MAX_HW_CARDS){
+ CANMSG("Maximum number of devices has been reached, no space for new device");
+ return NULL;
+ }
brp = boardtype_find(hwname);
if(!brp) {
CANMSG("Sorry, hardware \"%s\" is currently not supported.\n",hw[board]);