Module: kamailio
Branch: master
Commit: 23031aa75db09fb9b729f334cf35683861f6bf62
URL: 
https://github.com/kamailio/kamailio/commit/23031aa75db09fb9b729f334cf35683861f6bf62

Author: OrbisAI Security <[email protected]>
Committer: Daniel-Constantin Mierla <[email protected]>
Date: 2026-06-12T14:37:42+02:00

ldap: escape NUL byte per RFC 4515 in ldap_rfc4515_escape

Add missing '\0' -> '\00' escape case to ldap_rfc4515_escape() for
RFC 4515 §2.4 compliance. NUL is one of five characters RFC 4515
requires to be escaped in filter assertion values; the other four
(*, (, ), \) were already handled.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

---

Modified: src/modules/ldap/ldap_escape.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/23031aa75db09fb9b729f334cf35683861f6bf62.diff
Patch: 
https://github.com/kamailio/kamailio/commit/23031aa75db09fb9b729f334cf35683861f6bf62.patch

---

diff --git a/src/modules/ldap/ldap_escape.c b/src/modules/ldap/ldap_escape.c
index 55fe7aa3107..9feae505c47 100644
--- a/src/modules/ldap/ldap_escape.c
+++ b/src/modules/ldap/ldap_escape.c
@@ -59,6 +59,11 @@ int ldap_rfc4515_escape(str *sin, str *sout, int url_encode)
 
        while(src < (sin->s + sin->len)) {
                switch(*src) {
+                       case '\0':
+                               *dst++ = '\\';
+                               *dst++ = '0';
+                               *dst = '0';
+                               break;
                        case '*':
                                *dst++ = '\\';
                                *dst++ = '2';

_______________________________________________
Kamailio - Development Mailing List -- [email protected]
To unsubscribe send an email to [email protected]
Important: keep the mailing list in the recipients, do not reply only to the 
sender!

Reply via email to