mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-12-28 05:55:27 +01:00
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;
|
||||
#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 hostent **hpp, int nrflags)
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user