[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [tor/master] nodelist: use strcmpstart() instead of strncmp()
commit ab91302fd04d3ee03a2855c1ffb8570923f8d40c
Author: cypherpunks <cypherpunks@xxxxxxxxxxxxxx>
Date: Tue Sep 11 00:41:32 2018 +0000
nodelist: use strcmpstart() instead of strncmp()
in rend_parse_v2_service_descriptor.
Fix on c58675ca728f12b42f65e5b8964ae695c2e0ec2d
---
changes/ticket27630 | 3 +++
src/feature/nodelist/routerparse.c | 3 +--
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/changes/ticket27630 b/changes/ticket27630
new file mode 100644
index 000000000..8a5f5d6b5
--- /dev/null
+++ b/changes/ticket27630
@@ -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.
diff --git a/src/feature/nodelist/routerparse.c b/src/feature/nodelist/routerparse.c
index 73d320de4..b76b2974f 100644
--- a/src/feature/nodelist/routerparse.c
+++ b/src/feature/nodelist/routerparse.c
@@ -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;
}
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits