aboutsummaryrefslogtreecommitdiff
path: root/procps
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2009-01-08 03:35:47 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2009-01-08 03:35:47 +0000
commit501b0e335f33d6fa7c7bb5063f7be80281b0f698 (patch)
treec7a5aa64b2983a15ba4c1571c63ec16777eb9b8e /procps
parentcb39a7ca6dba94388657873651547c5ff320ad93 (diff)
downloadbusybox-501b0e335f33d6fa7c7bb5063f7be80281b0f698.tar.gz
sysctl: fix another corner case with "dots and slashes"
Diffstat (limited to 'procps')
-rw-r--r--procps/sysctl.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/procps/sysctl.c b/procps/sysctl.c
index 262574e61..d59e2690a 100644
--- a/procps/sysctl.c
+++ b/procps/sysctl.c
@@ -233,6 +233,12 @@ static void sysctl_dots_to_slashes(char *name)
* we replaced even one . -> /, start over again,
* but never replace dots before the position
* where last replacement occurred.
+ *
+ * Another bug we later had is that
+ * net.ipv4.conf.eth0.100
+ * (without .mc_forwarding) was mishandled.
+ *
+ * To set up testing: modprobe 8021q; vconfig add eth0 100
*/
end = name + strlen(name);
last_good = name - 1;
@@ -245,8 +251,8 @@ static void sysctl_dots_to_slashes(char *name)
*cptr = '\0';
//bb_error_msg("trying:'%s'", name);
if (access(name, F_OK) == 0) {
- *cptr = '/';
- *end = '\0'; /* prevent trailing '/' */
+ if (cptr != end) /* prevent trailing '/' */
+ *cptr = '/';
//bb_error_msg("replaced:'%s'", name);
last_good = cptr;
goto again;