diff options
author | Doug Hogan <doug@cvs.openbsd.org> | 2014-12-13 21:05:34 +0000 |
---|---|---|
committer | Doug Hogan <doug@cvs.openbsd.org> | 2014-12-13 21:05:34 +0000 |
commit | 80be619ed8893c124ce97f593c5d53c819023c7e (patch) | |
tree | 77561bf790a4f667f18e5d99327b02c906f29183 /sys/net/if_ppp.c | |
parent | 2bef9f90fd3a945ab3c0b8e3685da6dad3ca246f (diff) |
yet more mallocarray() changes.
ok tedu@ deraadt@
Diffstat (limited to 'sys/net/if_ppp.c')
-rw-r--r-- | sys/net/if_ppp.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/net/if_ppp.c b/sys/net/if_ppp.c index 6f67445802d..ce8471271f9 100644 --- a/sys/net/if_ppp.c +++ b/sys/net/if_ppp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ppp.c,v 1.78 2014/12/05 15:50:04 mpi Exp $ */ +/* $OpenBSD: if_ppp.c,v 1.79 2014/12/13 21:05:33 doug Exp $ */ /* $NetBSD: if_ppp.c,v 1.39 1997/05/17 21:11:59 christos Exp $ */ /* @@ -562,8 +562,9 @@ pppioctl(struct ppp_softc *sc, u_long cmd, caddr_t data, int flag, if ((unsigned) nbp->bf_len > BPF_MAXINSNS) return EINVAL; newcodelen = nbp->bf_len * sizeof(struct bpf_insn); - if (newcodelen != 0) { - newcode = malloc(newcodelen, M_DEVBUF, M_WAITOK); + if (nbp->bf_len != 0) { + newcode = mallocarray(nbp->bf_len, sizeof(struct bpf_insn), + M_DEVBUF, M_WAITOK); if ((error = copyin((caddr_t)nbp->bf_insns, (caddr_t)newcode, newcodelen)) != 0) { free(newcode, M_DEVBUF, 0); |