xt_geoip: check for allocation overflow

This commit is contained in:
Jan Engelhardt
2017-06-26 22:02:35 +02:00
parent a587f9526d
commit c839e87bbb

View File

@@ -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)
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);
if (p == NULL)
return ERR_PTR(-ENOMEM);