Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

avoid panic on RTM_IFINFO (due to decreased MHLEN).

From: Conny Larsson <conny@verkstad.net>
  • Loading branch information...
commit 2bb4f5a88b4ac4a89c65fa8d7fdbccbfb61e7e82 1 parent 1b98469
authored February 06, 2000

Showing 1 changed file with 11 additions and 4 deletions. Show diff stats Hide diff stats

  1. 15  freebsd2/sys/net/rtsock.c
15  freebsd2/sys/net/rtsock.c
@@ -534,9 +534,6 @@ rt_msg1(type, rtinfo)
534 534
 	register struct sockaddr *sa;
535 535
 	int len, dlen;
536 536
 
537  
-	m = m_gethdr(M_DONTWAIT, MT_DATA);
538  
-	if (m == 0)
539  
-		return (m);
540 537
 	switch (type) {
541 538
 
542 539
 	case RTM_DELADDR:
@@ -551,8 +548,18 @@ rt_msg1(type, rtinfo)
551 548
 	default:
552 549
 		len = sizeof(struct rt_msghdr);
553 550
 	}
554  
-	if (len > MHLEN)
  551
+	if (len > MCLBYTES)
555 552
 		panic("rt_msg1");
  553
+	m = m_gethdr(M_DONTWAIT, MT_DATA);
  554
+	if (m && len > MHLEN) {
  555
+		MCLGET(m, M_DONTWAIT);
  556
+		if ((m->m_flags & M_EXT) == 0) {
  557
+			m_free(m);
  558
+			m = NULL;
  559
+		}
  560
+	}
  561
+	if (m == 0)
  562
+		return (m);
556 563
 	m->m_pkthdr.len = m->m_len = len;
557 564
 	m->m_pkthdr.rcvif = 0;
558 565
 	rtm = mtod(m, struct rt_msghdr *);

0 notes on commit 2bb4f5a

Please sign in to comment.
Something went wrong with that request. Please try again.