From: Paul Hänsch Date: Sun, 13 Apr 2025 13:45:17 +0000 (+0200) Subject: limit comment name and content length X-Git-Url: https://git.plutz.net/?a=commitdiff_plain;p=webpoll limit comment name and content length --- diff --git a/comments.sh b/comments.sh index 90fdbb9..88791da 100755 --- a/comments.sh +++ b/comments.sh @@ -61,12 +61,12 @@ comments_updatecomment() { [ "$REQUEST_METHOD" = POST ] && case "$(POST action)" in postcomment) comments_postcomment \ "$(POST cuid |checkid)" \ - "$(POST username |grep -m1 -oE '[^[:space:]].*[^[:space:]]')" \ - "$(POST text)";; + "$(POST username |grep -m1 -oE '[^[:space:]].{0,126}[^[:space:]]')" \ + "$(POST text |dd status=none bs=2048 count=1)";; updatecomment) comments_updatecomment \ "$(POST cuid |checkid)" "$(POST updatekey)" \ - "$(POST username |grep -m1 -oE '[^[:space:]].*[^[:space:]]')" \ - "$(POST text)";; + "$(POST username |grep -m1 -oE '[^[:space:]].{0,126}[^[:space:]]')" \ + "$(POST text |dd status=none bs=2048 count=1)";; cancelcommentpost) REDIRECT "${_BASE}${PATH_INFO}#comments";; cancelcommentedit) REDIRECT "${_BASE}${PATH_INFO}#comment_$(POST cuid |checkid)";; esac