python-ldap/backport-CVE-2021-46823.patch
zhouwenpei ded1906ca0 fix CVE-2021-46823
(cherry picked from commit 55cc549f6b69a3190af311ddff7abe50304acd4e)
2022-07-26 19:41:05 +08:00

23 lines
879 B
Diff

From faa011b41f7141121546045925d809d54e70f5fd Mon Sep 17 00:00:00 2001
From: Kevin Backhouse <kevinbackhouse@github.com>
Date: Fri, 15 Oct 2021 15:21:37 +0100
Subject: [PATCH] Fix ReDoS in regex.
---
Lib/ldap/schema/tokenizer.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Lib/ldap/schema/tokenizer.py b/Lib/ldap/schema/tokenizer.py
index 69823f2b..623b86d5 100644
--- a/Lib/ldap/schema/tokenizer.py
+++ b/Lib/ldap/schema/tokenizer.py
@@ -13,7 +13,7 @@
r"|" # or
r"([^'$()\s]+)" # string of length >= 1 without '$() or whitespace
r"|" # or
- r"('(?:[^'\\]|\\\\|\\.)*?'(?!\w))"
+ r"('(?:[^'\\]|\\.)*'(?!\w))"
# any string or empty string surrounded by unescaped
# single quotes except if right quote is succeeded by
# alphanumeric char