change m_adj to reclaim unused mbufs instead of zero'ing m_len

when trim'ing space off the back of a chain; this is indirect
solution to a potential null ptr deref

Noticed by:	Coverity Prevent analysis tool (null ptr deref)
Reviewed by:	dg, rwatson
This commit is contained in:
Sam Leffler 2005-02-24 00:40:33 +00:00
parent 0fa17d320d
commit 59d8b31002
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=142350

View File

@ -691,12 +691,14 @@ m_adj(struct mbuf *mp, int req_len)
for (; m; m = m->m_next) {
if (m->m_len >= count) {
m->m_len = count;
if (m->m_next != NULL) {
m_freem(m->m_next);
m->m_next = NULL;
}
break;
}
count -= m->m_len;
}
while (m->m_next)
(m = m->m_next) ->m_len = 0;
}
}