{
/* Expect device to be of the form nt%d where %d is the stream id to use */
int dev_len = strlen(device);
+ if (dev_len < 3 || dev_len > 5) {
+ SCLogError(SC_ERR_NAPATECH_PARSE_CONFIG, "Could not parse config for device: %s - invalid length", device);
+ return NULL;
+ }
+
struct NapatechStreamDevConf *conf = SCCalloc(1, sizeof (struct NapatechStreamDevConf));
if (unlikely(conf == NULL)) {
SCLogError(SC_ERR_MEM_ALLOC, "Failed to allocate memory for NAPATECH device name.");
return NULL;
}
- if (dev_len < 3 || dev_len > 5) {
- SCLogError(SC_ERR_NAPATECH_PARSE_CONFIG, "Could not parse config for device: %s - invalid length", device);
- return NULL;
- }
/* device+5 is a pointer to the beginning of the stream id after the constant nt portion */
conf->stream_id = atoi(device + 2);