Module: kamailio
Branch: master
Commit: 5f3244c52987038f9b891c9464034fc5e8c3e310
URL: 
https://github.com/kamailio/kamailio/commit/5f3244c52987038f9b891c9464034fc5e8c3e310

Author: Xenofon Karamanos <x...@gilawa.com>
Committer: Daniel-Constantin Mierla <mico...@gmail.com>
Date: 2025-07-31T08:29:18+02:00

core: Fix urn parsing failing if @ is present

---

Modified: src/core/parser/parse_uri.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/5f3244c52987038f9b891c9464034fc5e8c3e310.diff
Patch: 
https://github.com/kamailio/kamailio/commit/5f3244c52987038f9b891c9464034fc5e8c3e310.patch

---

diff --git a/src/core/parser/parse_uri.c b/src/core/parser/parse_uri.c
index 718f6735422..bffb572dffc 100644
--- a/src/core/parser/parse_uri.c
+++ b/src/core/parser/parse_uri.c
@@ -203,12 +203,12 @@ int parse_uri(char *buf, int len, struct sip_uri *uri)
 #define TEL_SCH 0x3a6c6574
 #define URN_SCH 0x3a6e7275
 
-#define case_port(ch, var)           \
-       case ch:                         \
-               (var) = (var)*10 + ch - '0'; \
-               if((var) > MAX_PORT_VAL) {   \
-                       goto error_bad_port;     \
-               }                            \
+#define case_port(ch, var)             \
+       case ch:                           \
+               (var) = (var) * 10 + ch - '0'; \
+               if((var) > MAX_PORT_VAL) {     \
+                       goto error_bad_port;       \
+               }                              \
                break
 
 #define still_at_user                                      \
@@ -261,8 +261,12 @@ int parse_uri(char *buf, int len, struct sip_uri *uri)
                state = URI_HEADERS;       \
                s = p + 1;                 \
                break;                     \
-       case '&':                      \
        case '@':                      \
+               if(scheme != URN_SCH) {    \
+                       goto error_bad_char;   \
+               }                          \
+               break;                     \
+       case '&':                      \
                goto error_bad_char
 
 

_______________________________________________
Kamailio - Development Mailing List -- sr-dev@lists.kamailio.org
To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!

Reply via email to