Limit regex repetition to 255
authorStefan Huber <shuber@sthu.org>
Wed, 17 Feb 2021 10:09:23 +0000 (11:09 +0100)
committerStefan Huber <shuber@sthu.org>
Wed, 17 Feb 2021 19:29:04 +0000 (20:29 +0100)
The BSD implementation of regex has RE_DUP_MAX set to 255, e.g., see man
3 regex for openbsd. Limit the patterns to 255 to support mutt on BSD,
like Mac OS X (Darwin).

Fixes #1 (github)

Reported-by: reportaman
colors-gruvbox-shuber.muttrc

index c8daffba90f2c5c12447da996f8f8425d1342035..4339fabee88a2716fe46ed210812308686f00697 100644 (file)
@@ -62,8 +62,9 @@ color header color142 color234 "^Subject:"
 color header color108 color234 "^X-Spam-Status:"
 color header color108 color234 "^Received:"
 
-color body color142 color234 "[a-z]{3,256}://[-a-zA-Z0-9@:%._\\+~#=/?&,]+"
-color body color142 color234 "[a-zA-Z]([-a-zA-Z0-9_]+\\.){2,256}[-a-zA-Z0-9_]{2,256}"
+# BSD's regex has RE_DUP_MAX set to 255.
+color body color142 color234 "[a-z]{3,255}://[-a-zA-Z0-9@:%._\\+~#=/?&,]+"
+color body color142 color234 "[a-zA-Z]([-a-zA-Z0-9_]+\\.){2,255}[-a-zA-Z0-9_]{2,255}"
 color body color208 color234 "[-a-z_0-9.%$]+@[-a-z_0-9.]+\\.[-a-z][-a-z]+"
 color body color208 color234 "mailto:[-a-z_0-9.]+@[-a-z_0-9.]+"
 color body color234 color214 "[;:]-*[)>(<lt;|]"