Meaning that we support 65535 live devices at the most
return -1;
}
+ int id = LiveGetDeviceCount();
+ if (id > UINT16_MAX) {
+ SCFree(pd);
+ return -1;
+ }
+
pd->dev = SCStrdup(dev);
if (unlikely(pd->dev == NULL)) {
SCFree(pd);
SC_ATOMIC_INIT(pd->pkts);
SC_ATOMIC_INIT(pd->drop);
SC_ATOMIC_INIT(pd->invalid_checksums);
- pd->id = LiveGetDeviceCount();
+ pd->id = (uint16_t)id;
TAILQ_INSERT_TAIL(&live_devices, pd, next);
SCLogDebug("Device \"%s\" registered and created.", dev);
char dev_short[MAX_DEVNAME + 1];
bool tenant_id_set;
- int id;
+ uint16_t id;
SC_ATOMIC_DECLARE(uint64_t, pkts);
SC_ATOMIC_DECLARE(uint64_t, drop);