]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
hs-v3: Add an extra white-space when parsing descriptor
authorDavid Goulet <dgoulet@torproject.org>
Thu, 10 May 2018 13:16:50 +0000 (09:16 -0400)
committerDavid Goulet <dgoulet@torproject.org>
Thu, 10 May 2018 13:16:50 +0000 (09:16 -0400)
The specification describes the signature token to be right after a newline
(\n) then the token "signature" and then a white-space followed by the encoded
signature.

This commit makes sure that when we parse the signature from the descriptor,
we are always looking for that extra white-space at the end of the token.

It will allow us also to support future fields that might start with
"signature".

Fixes #26069

Signed-off-by: David Goulet <dgoulet@torproject.org>
changes/bug26069 [new file with mode: 0644]
src/or/hs_descriptor.c

diff --git a/changes/bug26069 b/changes/bug26069
new file mode 100644 (file)
index 0000000..192e97d
--- /dev/null
@@ -0,0 +1,5 @@
+  o Minor bugfixes (hidden service v3):
+    - When parsing the descriptor signature, look for the token plus an extra
+      white-space at the end. This is more correct but also will allow us to
+      support new fields that might start with "signature". Fixes bug 26069;
+      bugfix on 0.3.0.1-alpha.
index fae527b2db9b96b0e746e864e7568f792bc7517c..3ec02618bf52601f221bc4555a39bb11fa743b89 100644 (file)
@@ -1849,7 +1849,7 @@ desc_sig_is_valid(const char *b64_sig,
   }
 
   /* Find the start of signature. */
-  sig_start = tor_memstr(encoded_desc, encoded_len, "\n" str_signature);
+  sig_start = tor_memstr(encoded_desc, encoded_len, "\n" str_signature " ");
   /* Getting here means the token parsing worked for the signature so if we
    * can't find the start of the signature, we have a code flow issue. */
   if (!sig_start) {