diff options
author | Schanzenbach, Martin <mschanzenbach@posteo.de> | 2019-12-20 09:22:03 +0900 |
---|---|---|
committer | Schanzenbach, Martin <mschanzenbach@posteo.de> | 2019-12-20 09:22:03 +0900 |
commit | f1006d4f27314641f0c86ec7bf56edb2bf1f7e4c (patch) | |
tree | c42848c07742f0c972d07e939a272fb5ecf513b4 | |
parent | f0f45c5113bdc7a6ac0e009b491fdb63d6d6a79a (diff) | |
download | gnunet-f1006d4f27314641f0c86ec7bf56edb2bf1f7e4c.tar.gz gnunet-f1006d4f27314641f0c86ec7bf56edb2bf1f7e4c.zip |
fix BOX record label parsing
-rw-r--r-- | src/gns/gnunet-service-gns_resolver.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/gns/gnunet-service-gns_resolver.c b/src/gns/gnunet-service-gns_resolver.c index 97a51cd7e..2c2263e58 100644 --- a/src/gns/gnunet-service-gns_resolver.c +++ b/src/gns/gnunet-service-gns_resolver.c | |||
@@ -697,7 +697,7 @@ resolver_lookup_get_next_label (struct GNS_ResolverHandle *rh) | |||
697 | (dot - rh->name) - 1); | 697 | (dot - rh->name) - 1); |
698 | proto_name = GNUNET_strndup (&dot[2], | 698 | proto_name = GNUNET_strndup (&dot[2], |
699 | rh->name_resolution_pos - (dot - rh->name) | 699 | rh->name_resolution_pos - (dot - rh->name) |
700 | - 1); | 700 | - 2); |
701 | rh->name_resolution_pos = 0; | 701 | rh->name_resolution_pos = 0; |
702 | pe = getprotobyname (proto_name); | 702 | pe = getprotobyname (proto_name); |
703 | if (NULL == pe) | 703 | if (NULL == pe) |
@@ -715,15 +715,24 @@ resolver_lookup_get_next_label (struct GNS_ResolverHandle *rh) | |||
715 | { | 715 | { |
716 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 716 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
717 | _ ( | 717 | _ ( |
718 | "Service `%s' unknown for protocol `%s', skipping labels.\n"), | 718 | "Service `%s' unknown for protocol `%s', trying as number.\n"), |
719 | srv_name, | 719 | srv_name, |
720 | proto_name); | 720 | proto_name); |
721 | GNUNET_free (proto_name); | 721 | if (1 != sscanf (srv_name, "%u", &rh->service)) |
722 | GNUNET_free (srv_name); | 722 | { |
723 | return ret; | 723 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
724 | _ ("Service `%s' not a port, skipping service labels.\n"), | ||
725 | srv_name); | ||
726 | GNUNET_free (proto_name); | ||
727 | GNUNET_free (srv_name); | ||
728 | return ret; | ||
729 | } | ||
730 | } | ||
731 | else | ||
732 | { | ||
733 | rh->service = se->s_port; | ||
724 | } | 734 | } |
725 | rh->protocol = pe->p_proto; | 735 | rh->protocol = pe->p_proto; |
726 | rh->service = se->s_port; | ||
727 | GNUNET_free (proto_name); | 736 | GNUNET_free (proto_name); |
728 | GNUNET_free (srv_name); | 737 | GNUNET_free (srv_name); |
729 | } | 738 | } |