]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
nodelist: use strcmpstart() instead of strncmp()
authorcypherpunks <cypherpunks@torproject.org>
Tue, 11 Sep 2018 00:41:32 +0000 (00:41 +0000)
committercypherpunks <cypherpunks@torproject.org>
Wed, 12 Sep 2018 14:03:06 +0000 (14:03 +0000)
in rend_parse_v2_service_descriptor.
Fix on c58675ca728f12b42f65e5b8964ae695c2e0ec2d

changes/ticket27630 [new file with mode: 0644]
src/feature/nodelist/routerparse.c

diff --git a/changes/ticket27630 b/changes/ticket27630
new file mode 100644 (file)
index 0000000..8a5f5d6
--- /dev/null
@@ -0,0 +1,3 @@
+  o Code simplification and refactoring:
+    - Use the simpler strcmpstart() helper in rend_parse_v2_service_descriptor
+      instead of strncmp(). Closes ticket 27630.
index 73d320de400021a7eaa5e688339c3549e58bf7bb..b76b2974faeb06a5a745ffa783f6c951c1a82ae9 100644 (file)
@@ -5167,8 +5167,7 @@ rend_parse_v2_service_descriptor(rend_service_descriptor_t **parsed_out,
 
   tor_assert(desc);
   /* Check if desc starts correctly. */
-  if (strncmp(desc, "rendezvous-service-descriptor ",
-              strlen("rendezvous-service-descriptor "))) {
+  if (strcmpstart(desc, "rendezvous-service-descriptor ")) {
     log_info(LD_REND, "Descriptor does not start correctly.");
     goto err;
   }