From: Paul Hänsch Date: Thu, 30 Jan 2020 11:53:08 +0000 (+0100) Subject: Bugfix: fix crash in escape and unescape function when handling patterns like foo... X-Git-Url: https://git.plutz.net/?a=commitdiff_plain;ds=sidebyside;h=369cfbad801d25084da063f8ad3250dee9442fa9;p=lobster Bugfix: fix crash in escape and unescape function when handling patterns like foo[bar] --- diff --git a/pdiread.sh b/pdiread.sh index 49c2c20..c2654b6 100755 --- a/pdiread.sh +++ b/pdiread.sh @@ -112,7 +112,7 @@ pdi_escape(){ ,*) out="${out}\\,"; in="${in#,}" ;; \;*) out="${out}\\;"; in="${in#;}" ;; "$BR"*) out="${out}\\n"; in="${in#${BR}}" ;; - *) out="${out}${in%%[\\,;${BR}]*}"; in="${in#${in%%[\\,;${BR}]*}}" ;; + *) out="${out}${in%%[\\,;${BR}]*}"; in="${in#"${in%%[\\,;${BR}]*}"}" ;; esac; done done printf '%s\n' "$out" @@ -125,7 +125,7 @@ pdi_unescape(){ \\\\*) out="${out}\\"; in="${in#\\\\}" ;; \\n*) out="${out}${BR}"; in="${in#\\n}" ;; \\*) in="${in#\\}" ;; - *) out="${out}${in%%\\*}"; in="${in#${in%%\\*}}" ;; + *) out="${out}${in%%\\*}"; in="${in#"${in%%\\*}"}" ;; esac; done printf '%s\n' "$out" }