Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

avoid panic on RTM_IFINFO, due to decrased MHLEN.

From: Conny Larsson <conny@verkstad.net>
  • Loading branch information...
commit 704bca66a69dc4b8fa37fe75102c6851ccbccff9 1 parent 2bb4f5a
itojun authored
Showing with 11 additions and 4 deletions.
  1. +11 −4 netbsd/sys/net/rtsock.c
View
15 netbsd/sys/net/rtsock.c
@@ -530,9 +530,6 @@ rt_msg1(type, rtinfo)
register struct sockaddr *sa;
int len, dlen;
- m = m_gethdr(M_DONTWAIT, MT_DATA);
- if (m == 0)
- return (m);
switch (type) {
case RTM_DELADDR:
@@ -547,8 +544,18 @@ rt_msg1(type, rtinfo)
default:
len = sizeof(struct rt_msghdr);
}
- if (len > MHLEN)
+ if (len > MCLBYTES)
panic("rt_msg1");
+ m = m_gethdr(M_DONTWAIT, MT_DATA);
+ if (m && len > MHLEN) {
+ MCLGET(m, M_DONTWAIT);
+ if ((m->m_flags & M_EXT) == 0) {
+ m_free(m);
+ m = NULL;
+ }
+ }
+ if (m == 0)
+ return (m);
m->m_pkthdr.len = m->m_len = len;
m->m_pkthdr.rcvif = 0;
rtm = mtod(m, struct rt_msghdr *);
Please sign in to comment.
Something went wrong with that request. Please try again.