diff options
author | jlemon <jlemon@FreeBSD.org> | 2000-06-10 17:55:57 +0000 |
---|---|---|
committer | jlemon <jlemon@FreeBSD.org> | 2000-06-10 17:55:57 +0000 |
commit | 556a99d957a4d4dc30fb1d9391f5cbd18e2c963b (patch) | |
tree | a1e792aad0627b088c709d33bac063ada420fe94 /sys/netkey/keysock.c | |
parent | ad9c556957d20357dcf3d2212e47527daff4fe87 (diff) | |
download | FreeBSD-src-556a99d957a4d4dc30fb1d9391f5cbd18e2c963b.zip FreeBSD-src-556a99d957a4d4dc30fb1d9391f5cbd18e2c963b.tar.gz |
Check for MGET* returning NULL and return ENOBUFS in this case.
Submitted by: Bosko Milekic <bmilekic@technokratis.com>
Diffstat (limited to 'sys/netkey/keysock.c')
-rw-r--r-- | sys/netkey/keysock.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/sys/netkey/keysock.c b/sys/netkey/keysock.c index b3c8652..f26e8a5 100644 --- a/sys/netkey/keysock.c +++ b/sys/netkey/keysock.c @@ -419,13 +419,19 @@ key_sendup(so, msg, len, target) while (tlen > 0) { if (tlen == len) { MGETHDR(n, M_DONTWAIT, MT_DATA); + if (n == NULL) { + m_freem(m); + return ENOBUFS; + } n->m_len = MHLEN; } else { MGET(n, M_DONTWAIT, MT_DATA); + if (n == NULL) { + m_freem(m); + return ENOBUFS; + } n->m_len = MLEN; } - if (!n) - return ENOBUFS; if (tlen > MCLBYTES) { /*XXX better threshold? */ MCLGET(n, M_DONTWAIT); if ((n->m_flags & M_EXT) == 0) { |