From 3582e177e2769524b539c08ac1f76024f26a929e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Paul=20H=C3=A4nsch?= Date: Mon, 12 Jun 2023 13:38:47 +0200 Subject: [PATCH] Bugfix: file uploads got NULL characters converted to Linefeeds when using busybox sed --- multipart.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/multipart.sh b/multipart.sh index 09e3ca8..7c0d5dd 100755 --- a/multipart.sh +++ b/multipart.sh @@ -53,8 +53,9 @@ multipart(){ ;; "${CR}") if [ $state = dheader ]; then - sed -n "/--${multipart_boundary}\(--\)\?${CR}/q; p;" \ - | head -c-2 + # Do not use `sed -n` (or busybox sed will "convert" NULL to LF) + sed "/--${multipart_boundary}\(--\)\?${CR}/{x;q;}" \ + | head -c-3 return 0; fi [ $state = header ] && state=junk -- 2.39.2