mirror of
git://git.code.sf.net/p/xtables-addons/xtables-addons
synced 2025-09-06 12:45:13 +02:00
xt_geoip: check for allocation overflow
This commit is contained in:
@@ -75,7 +75,8 @@ geoip_add_node(const struct geoip_country_user __user *umem_ptr,
|
|||||||
|
|
||||||
if (copy_from_user(&umem, umem_ptr, sizeof(umem)) != 0)
|
if (copy_from_user(&umem, umem_ptr, sizeof(umem)) != 0)
|
||||||
return ERR_PTR(-EFAULT);
|
return ERR_PTR(-EFAULT);
|
||||||
|
if (umem.count > SIZE_MAX / geoproto_size[proto])
|
||||||
|
return ERR_PTR(-E2BIG);
|
||||||
p = kmalloc(sizeof(struct geoip_country_kernel), GFP_KERNEL);
|
p = kmalloc(sizeof(struct geoip_country_kernel), GFP_KERNEL);
|
||||||
if (p == NULL)
|
if (p == NULL)
|
||||||
return ERR_PTR(-ENOMEM);
|
return ERR_PTR(-ENOMEM);
|
||||||
|
Reference in New Issue
Block a user