mirror of
https://github.com/opnsense/src.git
synced 2026-06-08 16:22:46 -04:00
MFC r196149:
Add a check for a NULL mbuf ptr at the beginning of xdrmbuf_inline() so that it returns failure instead of crashing when "m->m_len" is executed and m == NULL. The mbuf ptr can be NULL when a call to xdrmbuf_getbytes() gets the bytes it needs, but they are at the end of a short RPC reply. When this happens, xdrmbuf_getbytes() returns success, but advances the mbuf ptr (xdrs->x_private) to m_next, which is NULL. If this is followed by a call to xdrmbuf_getlong(), it calls xdrmbuf_inline(), which would cause a crash by accessing "m->m_len". Approved by: re (rwatson), kib (mentor)
This commit is contained in:
parent
3eced0dd19
commit
e9200ba65b
1 changed files with 2 additions and 0 deletions
|
|
@ -282,6 +282,8 @@ xdrmbuf_inline(XDR *xdrs, u_int len)
|
|||
size_t available;
|
||||
char *p;
|
||||
|
||||
if (!m)
|
||||
return (0);
|
||||
if (xdrs->x_op == XDR_ENCODE) {
|
||||
available = M_TRAILINGSPACE(m) + (m->m_len - xdrs->x_handy);
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Reference in a new issue