Skip to content

Commit

Permalink
Fix bug that causes messages like
Browse files Browse the repository at this point in the history
    rsync: stack overflow in function match_address
on openbsd.  Patch from Brian Poole <raj@cerias.purdue.edu>.
  • Loading branch information
David Dykstra committed Jan 20, 2003
1 parent a405cda commit 7bc8218
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions access.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ static void make_mask(char *mask, int plen, int addrlen) {

if (w)
memset(mask, 0xff, w);
mask[w] = 0xff & (0xff<<(8-b));
if (w < addrlen)
mask[w] = 0xff & (0xff<<(8-b));
if (w+1 < addrlen)
memset(mask+w+1, 0, addrlen-w-1);

Expand Down Expand Up @@ -121,6 +122,8 @@ static int match_address(char *addr, char *tok)
a = (char *)&sin6a->sin6_addr;
t = (char *)&sin6t->sin6_addr;

addrlen = 16;

#ifdef HAVE_SOCKADDR_IN6_SCOPE_ID
if (sin6t->sin6_scope_id &&
sin6a->sin6_scope_id != sin6t->sin6_scope_id) {
Expand All @@ -129,10 +132,6 @@ static int match_address(char *addr, char *tok)
}
#endif

a = (char *)&sin6a->sin6_addr;
t = (char *)&sin6t->sin6_addr;
addrlen = 16;

break;
}
#endif
Expand Down

0 comments on commit 7bc8218

Please sign in to comment.