]> git.plutz.net Git - lobster/commitdiff
Bugfix: fix crash in escape and unescape function when handling patterns like foo...
authorPaul Hänsch <paul@plutz.net>
Thu, 30 Jan 2020 11:53:08 +0000 (12:53 +0100)
committerPaul Hänsch <paul@plutz.net>
Thu, 30 Jan 2020 11:53:08 +0000 (12:53 +0100)
pdiread.sh

index 49c2c20d88a7baca7754b0bde5d96482dbe4f3f8..c2654b68798fdb250aca46c0336b3f9d29012303 100755 (executable)
@@ -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"
 }