Instead, require that it *start* with "can" or "vcan", and be followed
by at least one digit.
This means that if you, for example, rename a regular interface as, for
example, "canopy", it will no longer be mistakenly treated as a CANbus
device (yes, this really happened, and a bug was filed against it).
}
#endif
-
#ifdef PCAP_SUPPORT_CAN
- if (strstr(device, "can") || strstr(device, "vcan")) {
+ if ((strncmp(device, "can", 3) == 0 && isdigit(device[3])) ||
+ (strncmp(device, "vcan", 4) == 0 && isigit(device[4]))) {
return can_create(device, ebuf);
}
#endif