]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
sip/parser: accept valid chars
authorGiuseppe Longo <giuseppe@glongo.it>
Tue, 1 Aug 2023 18:50:17 +0000 (20:50 +0200)
committerVictor Julien <victor@inliniac.net>
Tue, 11 Feb 2025 09:54:13 +0000 (10:54 +0100)
Accepts valid characters as defined in RFC3261.

cherry-picked from commit 7e993d5081c35d62eada429bad43430417267e5a

rust/src/sip/parser.rs

index a34bc2615e5357d624b596d6a1b066c5e51cfb4d..c7d616a498b4d816a955e20ecd69e0d5b10399b4 100644 (file)
@@ -15,7 +15,7 @@
  * 02110-1301, USA.
  */
 
-// written by Giuseppe Longo <giuseppe@glono.it>
+// written by Giuseppe Longo <giuseppe@glongo.it>
 
 use nom7::bytes::streaming::{take, take_while, take_while1};
 use nom7::character::streaming::{char, crlf};
@@ -57,9 +57,13 @@ pub struct Response {
     pub body_len: u16,
 }
 
+/**
+ * Valid tokens and chars are defined in RFC3261:
+ * https://www.rfc-editor.org/rfc/rfc3261#section-25.1
+ */
 #[inline]
 fn is_token_char(b: u8) -> bool {
-    is_alphanumeric(b) || b"!%'*+-._`".contains(&b)
+    is_alphanumeric(b) || b"!%'*+-._`~".contains(&b)
 }
 
 #[inline]
@@ -69,7 +73,7 @@ fn is_method_char(b: u8) -> bool {
 
 #[inline]
 fn is_request_uri_char(b: u8) -> bool {
-    is_alphanumeric(b) || is_token_char(b) || b"~#@:".contains(&b)
+    is_alphanumeric(b) || is_token_char(b) || b"~#@:;=?+&$,/".contains(&b)
 }
 
 #[inline]