pf: zero (another) output buffer in pfioctl

Avoid potential structure padding leak.  r350294 identified a leak via
static analysis; although there's no report of a leak with the
DIOCGETSRCNODES ioctl it's a good practice to zero the memory.

Suggested by:	kp
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
This commit is contained in:
emaste 2019-07-31 16:58:09 +00:00
parent dbdc8f667e
commit 2232ec44d9

View File

@ -3752,7 +3752,7 @@ pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td
nr = 0;
p = pstore = malloc(psn->psn_len, M_TEMP, M_WAITOK);
p = pstore = malloc(psn->psn_len, M_TEMP, M_WAITOK | M_ZERO);
for (i = 0, sh = V_pf_srchash; i <= pf_srchashmask;
i++, sh++) {
PF_HASHROW_LOCK(sh);