summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Fahlgren2025-08-23 21:36:44 +0000
committerHauke Mehrtens2025-08-31 23:39:30 +0000
commitbba95191ff2f22c9118a1ba1355b83afaa277ae3 (patch)
tree2181910ed4a7e3abe1e626e8f41e0f5e1d1a679b
parente61d2be87ba1b72a4bcb66b29449e80458c58875 (diff)
rpc-sys: packagelist: don't truncate input lines on read
When the /usr/lib/opkg/status file is read during 'ubus call rpc-sys packagelist', long input lines are being truncated, which produces incorrect package lists. The line read buffer is increased to 512, which should be able to handle the longest lines in the file. The 512 value was arrived at by examining the status file on several devices. The list of hostapd/wpad conflicts appears to have be longest line generated in opkg packages, but that second line of 259 characters containing the dependencies appears to be the actual root cause of the issues linked below. Here are the three longest lines I found on all of my installations (actual output truncated): $ awk '{print length(), $0}' /usr/lib/opkg/status | sort -n ... 188 Depends: kernel (= 6.6.93~35ef4dd36891d37023436baa842fa311-r1), ... kmod-lib-crc32c 259 Depends: hostapd-common (= 2024.09.15~5ace39b0-r2), libc, ... libmbedtls21 397 Conflicts: hostapd, hostapd-basic, hostapd-basic-openssl, ... wpad-basic-wolfssl Suggested-by: @hlhintz Fixes: https://github.com/efahl/owut/issues/28 Fixes: https://github.com/openwrt/rpcd/issues/16 Signed-off-by: Eric Fahlgren <ericfahlgren@gmail.com> Link: https://github.com/openwrt/rpcd/pull/18 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
-rw-r--r--sys.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sys.c b/sys.c
index a41095a..cd31320 100644
--- a/sys.c
+++ b/sys.c
@@ -188,7 +188,7 @@ rpc_sys_packagelist(struct ubus_context *ctx, struct ubus_object *obj,
struct blob_attr *tb[__RPC_PACKAGELIST_MAX];
bool all = false, installed = false, auto_installed = false;
struct blob_buf buf = { 0 };
- char line[256], tmp[128], pkg[128], ver[128];
+ char line[512], tmp[128], pkg[128], ver[128];
char *pkg_abi;
void *tbl;