MFC r196551:

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.

  Submitted by:	pjd
  Reviewed by:	{krw,sthen,markus}@openbsd.org

Approved by:	re (kib)
This commit is contained in:
Max Laier 2009-08-28 20:26:00 +00:00
parent 1b257b0e92
commit f2b31d1909
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/stable/8/; revision=196628

View File

@ -663,7 +663,7 @@ pfi_address_add(struct sockaddr *sa, int af, int net)
"(%d/%d)\n", pfi_buffer_cnt, PFI_BUFFER_MAX); "(%d/%d)\n", pfi_buffer_cnt, PFI_BUFFER_MAX);
return; return;
} }
memcpy(pfi_buffer, p, pfi_buffer_cnt * sizeof(*pfi_buffer)); memcpy(p, pfi_buffer, pfi_buffer_max * sizeof(*pfi_buffer));
/* no need to zero buffer */ /* no need to zero buffer */
free(pfi_buffer, PFI_MTYPE); free(pfi_buffer, PFI_MTYPE);
pfi_buffer = p; pfi_buffer = p;