|
@@ -485,6 +485,9 @@ static ssize_t pgctrl_write(struct file *file, const char __user *buf,
|
|
goto out;
|
|
goto out;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if (count == 0)
|
|
|
|
+ return -EINVAL;
|
|
|
|
+
|
|
if (count > sizeof(data))
|
|
if (count > sizeof(data))
|
|
count = sizeof(data);
|
|
count = sizeof(data);
|
|
|
|
|
|
@@ -492,7 +495,7 @@ static ssize_t pgctrl_write(struct file *file, const char __user *buf,
|
|
err = -EFAULT;
|
|
err = -EFAULT;
|
|
goto out;
|
|
goto out;
|
|
}
|
|
}
|
|
- data[count - 1] = 0; /* Make string */
|
|
|
|
|
|
+ data[count - 1] = 0; /* Strip trailing '\n' and terminate string */
|
|
|
|
|
|
if (!strcmp(data, "stop"))
|
|
if (!strcmp(data, "stop"))
|
|
pktgen_stop_all_threads_ifs(pn);
|
|
pktgen_stop_all_threads_ifs(pn);
|