From: Jo-Philipp Wich Date: Mon, 21 Aug 2023 14:37:11 +0000 (+0200) Subject: luci-base: http.uc: fix eof detection in temporary upload files X-Git-Url: http://git.openwrt.org/?a=commitdiff_plain;h=b4594b3d111171510d2581e9f0ce30bee78bd214;p=project%2Fluci.git luci-base: http.uc: fix eof detection in temporary upload files Binary string comparisons in ucode are currently unsafe, so use the `length()` function to determine the just read data chunk size in order to test for end of file. Fixes: #6530 Signed-off-by: Jo-Philipp Wich --- diff --git a/modules/luci-base/ucode/http.uc b/modules/luci-base/ucode/http.uc index 579dda3ced..e7f64ae6e9 100644 --- a/modules/luci-base/ucode/http.uc +++ b/modules/luci-base/ucode/http.uc @@ -430,7 +430,7 @@ const Class = { for (let name, value in this.message.params) { while (value?.fd) { let data = value.fd.read(1024); - let eof = (data == null || data == ''); + let eof = (length(data) == 0); this.filehandler(value, data, eof);