Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 1 Aug 2013 04:50:46 +0000 (UTC)
From:      Hiroki Sato <hrs@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r253852 - head/sbin/route
Message-ID:  <201308010450.r714okRX049076@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hrs
Date: Thu Aug  1 04:50:46 2013
New Revision: 253852
URL: http://svnweb.freebsd.org/changeset/base/253852

Log:
  Fix boundary check of sockaddr array.
  
  Reported by:	uqs

Modified:
  head/sbin/route/route.c

Modified: head/sbin/route/route.c
==============================================================================
--- head/sbin/route/route.c	Thu Aug  1 03:43:52 2013	(r253851)
+++ head/sbin/route/route.c	Thu Aug  1 04:50:46 2013	(r253852)
@@ -1146,6 +1146,8 @@ getaddr(int idx, char *str, struct hoste
 	char *q;
 #endif
 
+	if (idx < 0 || idx >= RTAX_MAX)
+		usage("internal error");
 	if (af == 0) {
 #if defined(INET)
 		af = AF_INET;
@@ -1162,9 +1164,6 @@ getaddr(int idx, char *str, struct hoste
 	hpp = NULL;
 #endif
 	rtm_addrs |= (1 << idx);
-
-	if (idx > RTAX_MAX)
-		usage("internal error");
 	sa = (struct sockaddr *)&so[idx];
 	sa->sa_family = af;
 	sa->sa_len = aflen;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201308010450.r714okRX049076>