|
@@ -1262,6 +1262,9 @@ do_replace(struct net *net, const void __user *user, unsigned int len)
|
|
|
/* overflow check */
|
|
|
if (tmp.num_counters >= INT_MAX / sizeof(struct xt_counters))
|
|
|
return -ENOMEM;
|
|
|
+ if (tmp.num_counters == 0)
|
|
|
+ return -EINVAL;
|
|
|
+
|
|
|
tmp.name[sizeof(tmp.name)-1] = 0;
|
|
|
|
|
|
newinfo = xt_alloc_table_info(tmp.size);
|
|
@@ -1809,6 +1812,9 @@ compat_do_replace(struct net *net, void __user *user, unsigned int len)
|
|
|
return -ENOMEM;
|
|
|
if (tmp.num_counters >= INT_MAX / sizeof(struct xt_counters))
|
|
|
return -ENOMEM;
|
|
|
+ if (tmp.num_counters == 0)
|
|
|
+ return -EINVAL;
|
|
|
+
|
|
|
tmp.name[sizeof(tmp.name)-1] = 0;
|
|
|
|
|
|
newinfo = xt_alloc_table_info(tmp.size);
|