Reapply r196551 which was accidentally reverted by r223637 (update to

OpenBSD pf 4.5).

Fix argument ordering to memcpy as well as the size of the copy in the
(theoretical) case that pfi_buffer_cnt should be greater than ~_max.

This fix the failure when you hit the self table size and force it to be
resized.

MFC after:	3 days
Sponsored by:	Rubicon Communications (Netgate)
This commit is contained in:
Luiz Otavio O Souza 2015-08-24 21:41:05 +00:00
parent e25d0a6df1
commit 22932fc9be

View File

@ -581,7 +581,7 @@ pfi_address_add(struct sockaddr *sa, int af, int net)
__func__, V_pfi_buffer_cnt, PFI_BUFFER_MAX);
return;
}
memcpy(V_pfi_buffer, p, V_pfi_buffer_cnt * sizeof(*V_pfi_buffer));
memcpy(p, V_pfi_buffer, V_pfi_buffer_max * sizeof(*V_pfi_buffer));
/* no need to zero buffer */
free(V_pfi_buffer, PFI_MTYPE);
V_pfi_buffer = p;