From d61539cdd435eb812053104ab5a12700607732be Mon Sep 17 00:00:00 2001 From: =?utf8?q?Paul=20H=C3=A4nsch?= Date: Mon, 19 Jun 2023 15:24:26 +0200 Subject: [PATCH] bugfix: prevent endless loop in HEX_DECODE, copy non-hex-digits unchanged --- cgilite.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cgilite.sh b/cgilite.sh index b51ee8e..b915a8f 100755 --- a/cgilite.sh +++ b/cgilite.sh @@ -85,6 +85,12 @@ HEX_DECODE(){ # will be copied to the output literally while [ "$in" ]; do + [ "$pfx" ] || case $in in + [0-9a-fA-F][0-9a-fA-F]*):;; + ?*) out="${out}${in%%"${in#?}"}" + in="${in#?}"; continue;; + esac + case $in in "$pfx"[0-9a-fA-F][0-9a-fA-F]*) in="${in#${pfx}}";; \\*) in="${in#?}"; out="${out}\\\\"; continue;; -- 2.39.2