2
0
mirror of https://codeberg.org/kiss-community/repo synced 2025-01-21 01:44:41 -07:00

busybox: fix awk handling of literal backslashes

closes #211
This commit is contained in:
Owen Rafferty 2025-01-20 10:07:32 -06:00
parent 26db22ec3b
commit 83f342bc7b
No known key found for this signature in database
4 changed files with 22 additions and 1 deletions

View File

@ -10,6 +10,7 @@ f17db98491aab9d838e5c0b64e896b619bba5b9c819f11871692338c94cbcbd460
0a1941324ddafd093406d518ee1fca0c3d6c6839e1834889013fc935dd1bdd2f85 0a1941324ddafd093406d518ee1fca0c3d6c6839e1834889013fc935dd1bdd2f85
a25b0ce9d36091e9368ccd527dec9594582cce097c5de17ad33c7c85b4543a90fd a25b0ce9d36091e9368ccd527dec9594582cce097c5de17ad33c7c85b4543a90fd
f62969ee1426bea40ffd603cb01aa4f6e264930ce29a0266b776f5d08253772a78 f62969ee1426bea40ffd603cb01aa4f6e264930ce29a0266b776f5d08253772a78
a206d4463ceeb27d5092ea97d7db04a9af64e8e8b004bdb06d3eb3a957fb0419fe
2fc84cd00bba1a27bb692fb61f7b06307bd2a618161c1f019efd5a8432b0f3c53f 2fc84cd00bba1a27bb692fb61f7b06307bd2a618161c1f019efd5a8432b0f3c53f
473bf2b8963fb8fc28fd05edc36d610606f77a6f34f652e951e3f68a8473ba4913 473bf2b8963fb8fc28fd05edc36d610606f77a6f34f652e951e3f68a8473ba4913
370c6baac161233f55409fa1f4f8a381e6c516a957a781ad307e4704a604e9016a 370c6baac161233f55409fa1f4f8a381e6c516a957a781ad307e4704a604e9016a

View File

@ -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;
}
}

View File

@ -10,6 +10,7 @@ files/syslogd.run
patches/CVE-2022-28391.patch patches/CVE-2022-28391.patch
patches/CVE-2023-42366.patch patches/CVE-2023-42366.patch
patches/adduser-no-setgid.patch patches/adduser-no-setgid.patch
patches/awk-fix-literal-backslash.patch
patches/fsck-resolve-uuid.patch patches/fsck-resolve-uuid.patch
patches/init-use-baseinit.patch patches/init-use-baseinit.patch
patches/lineedit-Handle-SIGWINCH-gracefully.patch patches/lineedit-Handle-SIGWINCH-gracefully.patch

View File

@ -1 +1 @@
1.37.0 1 1.37.0 2