Fix IP_FW_NAT44_LIST_NAT size calculation.

Found by:	lev
Sponsored by:	Yandex LLC
This commit is contained in:
melifaro 2015-02-05 14:54:53 +00:00
parent 843b07f861
commit b45491786e

View File

@ -691,7 +691,7 @@ nat44_get_cfg(struct ip_fw_chain *chain, ip_fw3_opheader *op3,
export_nat_cfg(ptr, ucfg);
/* Estimate memory amount */
sz = sizeof(struct nat44_cfg_nat);
sz = sizeof(ipfw_obj_header) + sizeof(struct nat44_cfg_nat);
LIST_FOREACH(r, &ptr->redir_chain, _next) {
sz += sizeof(struct nat44_cfg_redir);
LIST_FOREACH(s, &r->spool_chain, _next)
@ -699,7 +699,7 @@ nat44_get_cfg(struct ip_fw_chain *chain, ip_fw3_opheader *op3,
}
ucfg->size = sz;
if (sd->valsize < sz + sizeof(*oh)) {
if (sd->valsize < sz) {
/*
* Submitted buffer size is not enough.