gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnunet] branch master updated: fix BOX record label parsing


From: gnunet
Subject: [gnunet] branch master updated: fix BOX record label parsing
Date: Fri, 20 Dec 2019 01:25:16 +0100

This is an automated email from the git hooks/post-receive script.

martin-schanzenbach pushed a commit to branch master
in repository gnunet.

The following commit(s) were added to refs/heads/master by this push:
     new f1006d4f2 fix BOX record label parsing
f1006d4f2 is described below

commit f1006d4f27314641f0c86ec7bf56edb2bf1f7e4c
Author: Schanzenbach, Martin <address@hidden>
AuthorDate: Fri Dec 20 09:22:03 2019 +0900

    fix BOX record label parsing
---
 src/gns/gnunet-service-gns_resolver.c | 21 +++++++++++++++------
 1 file 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)
                                (dot - rh->name) - 1);
     proto_name = GNUNET_strndup (&dot[2],
                                  rh->name_resolution_pos - (dot - rh->name)
-                                 - 1);
+                                 - 2);
     rh->name_resolution_pos = 0;
     pe = getprotobyname (proto_name);
     if (NULL == pe)
@@ -715,15 +715,24 @@ resolver_lookup_get_next_label (struct GNS_ResolverHandle 
*rh)
     {
       GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
                   _ (
-                    "Service `%s' unknown for protocol `%s', skipping 
labels.\n"),
+                    "Service `%s' unknown for protocol `%s', trying as 
number.\n"),
                   srv_name,
                   proto_name);
-      GNUNET_free (proto_name);
-      GNUNET_free (srv_name);
-      return ret;
+      if (1 != sscanf (srv_name, "%u", &rh->service))
+      {
+        GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+                    _ ("Service `%s' not a port, skipping service labels.\n"),
+                    srv_name);
+        GNUNET_free (proto_name);
+        GNUNET_free (srv_name);
+        return ret;
+      }
+    }
+    else
+    {
+      rh->service = se->s_port;
     }
     rh->protocol = pe->p_proto;
-    rh->service = se->s_port;
     GNUNET_free (proto_name);
     GNUNET_free (srv_name);
   }

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]