luci-base: rpc: fix luci/getMountPoints crash
authorLiangbin Lian <jjm2473@gmail.com>
Thu, 8 Jan 2026 18:25:11 +0000 (02:25 +0800)
committerPaul Donald <newtwen+github@gmail.com>
Fri, 9 Jan 2026 20:52:18 +0000 (21:52 +0100)
getMountPoints crash on path containing '\xxx'.

`char` should be `chr`

Fixes https://github.com/openwrt/openwrt/issues/21459

Signed-off-by: Liangbin Lian <jjm2473@gmail.com>
modules/luci-base/root/usr/share/rpcd/ucode/luci

index 55a55726bfbf40460a88eb3c7699a82a5adce62b..c7796197455463cdef5bf094224f5a5d0ede935b 100644 (file)
@@ -541,8 +541,8 @@ const methods = {
 
                                for (let line = fd.read('line'); length(line); line = fd.read('line')) {
                                        const m = split(line, ' ');
-                                       const device = replace(m[0], /\\([0-9][0-9][0-9])/g, (m, n) => char(int(n, 8)));
-                                       const mount  = replace(m[1], /\\([0-9][0-9][0-9])/g, (m, n) => char(int(n, 8)));
+                                       const device = replace(m[0], /\\([0-9][0-9][0-9])/g, (m, n) => chr(int(n, 8)));
+                                       const mount  = replace(m[1], /\\([0-9][0-9][0-9])/g, (m, n) => chr(int(n, 8)));
                                        const stat = statvfs(mount);
 
                                        if (stat?.blocks > 0) {