Fix boundary check of sockaddr array.
Reported by: uqs
This commit is contained in:
parent
9e1db66eb4
commit
15768a8b07
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=253852
@ -1146,6 +1146,8 @@ getaddr(int idx, char *str, struct hostent **hpp, int nrflags)
|
|||||||
char *q;
|
char *q;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (idx < 0 || idx >= RTAX_MAX)
|
||||||
|
usage("internal error");
|
||||||
if (af == 0) {
|
if (af == 0) {
|
||||||
#if defined(INET)
|
#if defined(INET)
|
||||||
af = AF_INET;
|
af = AF_INET;
|
||||||
@ -1162,9 +1164,6 @@ getaddr(int idx, char *str, struct hostent **hpp, int nrflags)
|
|||||||
hpp = NULL;
|
hpp = NULL;
|
||||||
#endif
|
#endif
|
||||||
rtm_addrs |= (1 << idx);
|
rtm_addrs |= (1 << idx);
|
||||||
|
|
||||||
if (idx > RTAX_MAX)
|
|
||||||
usage("internal error");
|
|
||||||
sa = (struct sockaddr *)&so[idx];
|
sa = (struct sockaddr *)&so[idx];
|
||||||
sa->sa_family = af;
|
sa->sa_family = af;
|
||||||
sa->sa_len = aflen;
|
sa->sa_len = aflen;
|
||||||
|
Loading…
Reference in New Issue
Block a user