summaryrefslogtreecommitdiffstats
path: root/sys/netgraph/ng_tee.c
diff options
context:
space:
mode:
authorarchie <archie@FreeBSD.org>1999-11-08 03:11:22 +0000
committerarchie <archie@FreeBSD.org>1999-11-08 03:11:22 +0000
commit2f772ace57a1b77273ed06935a57cb79ab89b02a (patch)
treea970f4bae04d588ad6f046d5816b64dd479ab3ff /sys/netgraph/ng_tee.c
parent4336de9993991afb8b7bcd10a20d98ce83b86fe6 (diff)
downloadFreeBSD-src-2f772ace57a1b77273ed06935a57cb79ab89b02a.zip
FreeBSD-src-2f772ace57a1b77273ed06935a57cb79ab89b02a.tar.gz
Fix crash when trying to duplicate a NULL meta.
Diffstat (limited to 'sys/netgraph/ng_tee.c')
-rw-r--r--sys/netgraph/ng_tee.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/sys/netgraph/ng_tee.c b/sys/netgraph/ng_tee.c
index 8874e49..7ae417c 100644
--- a/sys/netgraph/ng_tee.c
+++ b/sys/netgraph/ng_tee.c
@@ -266,15 +266,18 @@ ngt_rcvdata(hook_p hook, struct mbuf *m, meta_p meta)
}
/* Copy meta info */
- MALLOC(meta2, meta_p,
- meta->used_len, M_NETGRAPH, M_NOWAIT);
- if (meta2 == NULL) {
- m_freem(m2);
- NG_FREE_DATA(m, meta);
- return (ENOMEM);
- }
- meta2->allocated_len = meta->used_len;
- bcopy(meta, meta2, meta->used_len);
+ if (meta != NULL) {
+ MALLOC(meta2, meta_p,
+ meta->used_len, M_NETGRAPH, M_NOWAIT);
+ if (meta2 == NULL) {
+ m_freem(m2);
+ NG_FREE_DATA(m, meta);
+ return (ENOMEM);
+ }
+ bcopy(meta, meta2, meta->used_len);
+ meta2->allocated_len = meta->used_len;
+ } else
+ meta2 = NULL;
/* Deliver duplicate */
dup->stats.outOctets += m->m_pkthdr.len;
OpenPOWER on IntegriCloud