summaryrefslogtreecommitdiff
path: root/sys/net80211/ieee80211_crypto_ccmp.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/net80211/ieee80211_crypto_ccmp.c')
-rw-r--r--sys/net80211/ieee80211_crypto_ccmp.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/sys/net80211/ieee80211_crypto_ccmp.c b/sys/net80211/ieee80211_crypto_ccmp.c
index b3f15adb054..728a363c25b 100644
--- a/sys/net80211/ieee80211_crypto_ccmp.c
+++ b/sys/net80211/ieee80211_crypto_ccmp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ieee80211_crypto_ccmp.c,v 1.8 2008/12/03 17:25:41 damien Exp $ */
+/* $OpenBSD: ieee80211_crypto_ccmp.c,v 1.9 2009/09/13 14:42:52 krw Exp $ */
/*-
* Copyright (c) 2008 Damien Bergamini <damien.bergamini@free.fr>
@@ -176,7 +176,10 @@ ieee80211_ccmp_encrypt(struct ieee80211com *ic, struct mbuf *m0,
MGET(n0, M_DONTWAIT, m0->m_type);
if (n0 == NULL)
goto nospace;
- M_DUP_PKTHDR(n0, m0);
+ if (m_dup_pkthdr(n0, m0)) {
+ m_free(n0);
+ goto nospace;
+ }
n0->m_pkthdr.len += IEEE80211_CCMP_HDRLEN;
n0->m_len = MHLEN;
if (n0->m_pkthdr.len >= MINCLSIZE - IEEE80211_CCMP_MICLEN) {
@@ -354,7 +357,10 @@ ieee80211_ccmp_decrypt(struct ieee80211com *ic, struct mbuf *m0,
MGET(n0, M_DONTWAIT, m0->m_type);
if (n0 == NULL)
goto nospace;
- M_DUP_PKTHDR(n0, m0);
+ if (m_dup_pkthdr(n0, m0)) {
+ m_free(n0);
+ goto nospace;
+ }
n0->m_pkthdr.len -= IEEE80211_CCMP_HDRLEN + IEEE80211_CCMP_MICLEN;
n0->m_len = MHLEN;
if (n0->m_pkthdr.len >= MINCLSIZE) {