[go: nahoru, domu]

Skip to content

Commit

Permalink
Avoid out-of-bounds read
Browse files Browse the repository at this point in the history
Fixes CVE 2017-3735

Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
(Merged from #4276)

(cherry picked from commit b231717)
  • Loading branch information
Rich Salz committed Aug 28, 2017
1 parent 917552f commit 31c8b26
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions crypto/x509v3/v3_addr.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,12 @@ static int length_from_afi(const unsigned afi)
*/
unsigned int v3_addr_get_afi(const IPAddressFamily *f)
{
return ((f != NULL &&
f->addressFamily != NULL && f->addressFamily->data != NULL)
? ((f->addressFamily->data[0] << 8) | (f->addressFamily->data[1]))
: 0);
if (f == NULL
|| f->addressFamily == NULL
|| f->addressFamily->data == NULL
|| f->addressFamily->length < 2)
return 0;
return (f->addressFamily->data[0] << 8) | f->addressFamily->data[1];
}

/*
Expand Down

0 comments on commit 31c8b26

Please sign in to comment.