From 369cfbad801d25084da063f8ad3250dee9442fa9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Paul=20H=C3=A4nsch?= Date: Thu, 30 Jan 2020 12:53:08 +0100 Subject: [PATCH] Bugfix: fix crash in escape and unescape function when handling patterns like foo[bar] --- pdiread.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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" } -- 2.39.2