[FS#332] uci config enumeration flaw
LEDE Bugs
lede-bugs at lists.infradead.org
Mon Dec 12 02:59:55 PST 2016
A new Flyspray task has been opened. Details are below.
User who did this - bolvan (bolvan)
Attached to Project - LEDE Project
Summary - uci config enumeration flaw
Task Type - Bug Report
Category - Base system
Status - Unconfirmed
Assigned To -
Operating System - All
Severity - Medium
Priority - Very Low
Reported Version - Trunk
Due in Version - Undecided
Due Date - Undecided
Details - Original visible issue is seeing always "Changes: 0" in LUCI UI.
https://github.com/openwrt/luci/issues/856#issuecomment-266218003
I traced the reason to libuci.so.
(file.c) uci_list_config_files enumerates all files in /etc/config including directories
if directory is found then get_filename returns null
configs[i] remains unset and in most cases contain NULL
all parts of code that use config enumeration stop on first NULL
If a directory exist in /etc/config then all fails
char **configs = NULL;
char **p;
if ((uci_list_configs(ctx, &configs) != UCI_OK) || !configs) {
cli_perror();
goto out;
}
for (p = configs; *p; p++) {
package_cmd(cmd, *p);
}
This patch to file.c fixes the problem
838c838
< int size, i;
---
> int size, i, j;
862c862
< for(i = 0; i < globbuf.gl_pathc; i++) {
---
> for(i = 0, j = 0; i < globbuf.gl_pathc; i++) {
872c872
< configs[i] = buf;
---
> configs[j++] = buf;
More information can be found at the following URL:
https://bugs.lede-project.org/index.php?do=details&task_id=332
More information about the lede-bugs
mailing list