summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2023-08-21 16:37:11 +0200
committerJo-Philipp Wich <jo@mein.io>2023-08-21 16:37:11 +0200
commitb4594b3d111171510d2581e9f0ce30bee78bd214 (patch)
tree697574dda3c4a7cfa3e66cace7d8c37c8050b4aa
parent18b637fed9f58b7a3f146a004ecd5b0aef2cb058 (diff)
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 <jo@mein.io>
-rw-r--r--modules/luci-base/ucode/http.uc2
1 files changed, 1 insertions, 1 deletions
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);