diff options
| author | Daniel Golle | 2024-10-23 20:06:18 +0000 |
|---|---|---|
| committer | Hauke Mehrtens | 2025-08-23 14:11:27 +0000 |
| commit | e61d2be87ba1b72a4bcb66b29449e80458c58875 (patch) | |
| tree | 73135788b13cd2fac3033986343e4f5d8846a05a | |
| parent | 8b320f99ac6f8fb24092183f11b5948d7e00495e (diff) | |
sys: use strstr() to detect installed packages
Don't rely on sscanf() doesn't care about unused suffixes of the status
string. Use strstr() instead to make sure only actually installed
packages are returned.
Suggested-by: Eric Fahlgren <ericfahlgren@gmail.com>
Reported-by: Eric Fahlgren <ericfahlgren@gmail.com>
Fixes: #6
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Link: https://github.com/openwrt/rpcd/pull/8
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
| -rw-r--r-- | sys.c | 3 |
1 files changed, 1 insertions, 2 deletions
@@ -233,8 +233,7 @@ rpc_sys_packagelist(struct ubus_context *ctx, struct ubus_object *obj, break; case 'S': if (is_field("Status", line)) - if (sscanf(line, "Status: install %63s installed", tmp) == 1) - installed = true; + installed = !!strstr(line, " installed"); break; default: if (is_blank(line)) { |