svn commit: r253852 - head/sbin/route
Hiroki Sato
hrs at FreeBSD.org
Thu Aug 1 04:50:47 UTC 2013
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;
More information about the svn-src-head
mailing list