From 83f342bc7b1ff78982b499728bfadd854c45a549 Mon Sep 17 00:00:00 2001 From: Owen Rafferty Date: Mon, 20 Jan 2025 10:07:32 -0600 Subject: [PATCH] busybox: fix awk handling of literal backslashes closes #211 --- core/busybox/checksums | 1 + .../patches/awk-fix-literal-backslash.patch | 19 +++++++++++++++++++ core/busybox/sources | 1 + core/busybox/version | 2 +- 4 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 core/busybox/patches/awk-fix-literal-backslash.patch diff --git a/core/busybox/checksums b/core/busybox/checksums index 0bbb43f0..45c2c10f 100644 --- a/core/busybox/checksums +++ b/core/busybox/checksums @@ -10,6 +10,7 @@ f17db98491aab9d838e5c0b64e896b619bba5b9c819f11871692338c94cbcbd460 0a1941324ddafd093406d518ee1fca0c3d6c6839e1834889013fc935dd1bdd2f85 a25b0ce9d36091e9368ccd527dec9594582cce097c5de17ad33c7c85b4543a90fd f62969ee1426bea40ffd603cb01aa4f6e264930ce29a0266b776f5d08253772a78 +a206d4463ceeb27d5092ea97d7db04a9af64e8e8b004bdb06d3eb3a957fb0419fe 2fc84cd00bba1a27bb692fb61f7b06307bd2a618161c1f019efd5a8432b0f3c53f 473bf2b8963fb8fc28fd05edc36d610606f77a6f34f652e951e3f68a8473ba4913 370c6baac161233f55409fa1f4f8a381e6c516a957a781ad307e4704a604e9016a diff --git a/core/busybox/patches/awk-fix-literal-backslash.patch b/core/busybox/patches/awk-fix-literal-backslash.patch new file mode 100644 index 00000000..61454861 --- /dev/null +++ b/core/busybox/patches/awk-fix-literal-backslash.patch @@ -0,0 +1,19 @@ +diff --git a/editors/awk.c b/editors/awk.c +index 64e752f4b..40f5ba7f7 100644 +--- a/editors/awk.c ++++ b/editors/awk.c +@@ -2636,8 +2636,13 @@ static int awk_sub(node *rn, const char *repl, int nm, var *src, var *dest /*,in + resbuf = qrealloc(resbuf, residx + replen + n, &resbufsize); + memcpy(resbuf + residx, sp + pmatch[j].rm_so - start_ofs, n); + residx += n; +- } else ++ } else { ++/* '\\' and '&' following a backslash keep its original meaning, any other ++ * occurrence of a '\\' should be treated as literal */ ++ if (bslash && c != '\\' && c != '&') ++ resbuf[residx++] = '\\'; + resbuf[residx++] = c; ++ } + bslash = 0; + } + } diff --git a/core/busybox/sources b/core/busybox/sources index 11291d92..8e18bde4 100644 --- a/core/busybox/sources +++ b/core/busybox/sources @@ -10,6 +10,7 @@ files/syslogd.run patches/CVE-2022-28391.patch patches/CVE-2023-42366.patch patches/adduser-no-setgid.patch +patches/awk-fix-literal-backslash.patch patches/fsck-resolve-uuid.patch patches/init-use-baseinit.patch patches/lineedit-Handle-SIGWINCH-gracefully.patch diff --git a/core/busybox/version b/core/busybox/version index 0d2987c6..494c44cf 100644 --- a/core/busybox/version +++ b/core/busybox/version @@ -1 +1 @@ -1.37.0 1 +1.37.0 2