aboutsummaryrefslogtreecommitdiff
path: root/src/gns/gnunet-service-gns_resolver.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2018-05-20 19:06:46 +0200
committerChristian Grothoff <christian@grothoff.org>2018-05-20 19:06:46 +0200
commitd9137653d89ed3497d8a23dc049216bd316e07ce (patch)
tree124cbb2ffb6db0a2498a7bef1880bf70d3fd7417 /src/gns/gnunet-service-gns_resolver.c
parentbd4d98e353daae5820c7afd32f651c1e5e0876b8 (diff)
downloadgnunet-d9137653d89ed3497d8a23dc049216bd316e07ce.tar.gz
gnunet-d9137653d89ed3497d8a23dc049216bd316e07ce.zip
guard more carefully against integer overflows
Diffstat (limited to 'src/gns/gnunet-service-gns_resolver.c')
-rw-r--r--src/gns/gnunet-service-gns_resolver.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/gns/gnunet-service-gns_resolver.c b/src/gns/gnunet-service-gns_resolver.c
index edb3d5231..b66516363 100644
--- a/src/gns/gnunet-service-gns_resolver.c
+++ b/src/gns/gnunet-service-gns_resolver.c
@@ -1654,6 +1654,8 @@ recursive_gns2dns_resolution (struct GNS_ResolverHandle *rh,
1654 size_t off; 1654 size_t off;
1655 struct Gns2DnsPending *gp; 1655 struct Gns2DnsPending *gp;
1656 struct GNUNET_CRYPTO_EcdsaPublicKey zone; 1656 struct GNUNET_CRYPTO_EcdsaPublicKey zone;
1657 struct sockaddr_in v4;
1658 struct sockaddr_in6 v6;
1657 1659
1658 if (GNUNET_GNSRECORD_TYPE_GNS2DNS != rd[i].record_type) 1660 if (GNUNET_GNSRECORD_TYPE_GNS2DNS != rd[i].record_type)
1659 continue; 1661 continue;
@@ -1695,10 +1697,16 @@ recursive_gns2dns_resolution (struct GNS_ResolverHandle *rh,
1695 } 1697 }
1696 1698
1697 /* check if 'ip' is already an IPv4/IPv6 address */ 1699 /* check if 'ip' is already an IPv4/IPv6 address */
1698 if (GNUNET_OK == 1700 if ( (1 == inet_pton (AF_INET,
1699 GNUNET_DNSSTUB_add_dns_ip (ac->authority_info.dns_authority.dns_handle, 1701 ip,
1700 ip)) 1702 &v4)) ||
1703 (1 == inet_pton (AF_INET6,
1704 ip,
1705 &v6)) )
1701 { 1706 {
1707 GNUNET_break (GNUNET_OK ==
1708 GNUNET_DNSSTUB_add_dns_ip (ac->authority_info.dns_authority.dns_handle,
1709 ip));
1702 ac->authority_info.dns_authority.found = GNUNET_YES; 1710 ac->authority_info.dns_authority.found = GNUNET_YES;
1703 GNUNET_free (ip); 1711 GNUNET_free (ip);
1704 continue; 1712 continue;