diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2009-01-08 03:35:47 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2009-01-08 03:35:47 +0000 |
commit | 501b0e335f33d6fa7c7bb5063f7be80281b0f698 (patch) | |
tree | c7a5aa64b2983a15ba4c1571c63ec16777eb9b8e /procps/sysctl.c | |
parent | cb39a7ca6dba94388657873651547c5ff320ad93 (diff) | |
download | busybox-w32-501b0e335f33d6fa7c7bb5063f7be80281b0f698.tar.gz busybox-w32-501b0e335f33d6fa7c7bb5063f7be80281b0f698.tar.bz2 busybox-w32-501b0e335f33d6fa7c7bb5063f7be80281b0f698.zip |
sysctl: fix another corner case with "dots and slashes"
Diffstat (limited to 'procps/sysctl.c')
-rw-r--r-- | procps/sysctl.c | 10 |
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) | |||
233 | * we replaced even one . -> /, start over again, | 233 | * we replaced even one . -> /, start over again, |
234 | * but never replace dots before the position | 234 | * but never replace dots before the position |
235 | * where last replacement occurred. | 235 | * where last replacement occurred. |
236 | * | ||
237 | * Another bug we later had is that | ||
238 | * net.ipv4.conf.eth0.100 | ||
239 | * (without .mc_forwarding) was mishandled. | ||
240 | * | ||
241 | * To set up testing: modprobe 8021q; vconfig add eth0 100 | ||
236 | */ | 242 | */ |
237 | end = name + strlen(name); | 243 | end = name + strlen(name); |
238 | last_good = name - 1; | 244 | last_good = name - 1; |
@@ -245,8 +251,8 @@ static void sysctl_dots_to_slashes(char *name) | |||
245 | *cptr = '\0'; | 251 | *cptr = '\0'; |
246 | //bb_error_msg("trying:'%s'", name); | 252 | //bb_error_msg("trying:'%s'", name); |
247 | if (access(name, F_OK) == 0) { | 253 | if (access(name, F_OK) == 0) { |
248 | *cptr = '/'; | 254 | if (cptr != end) /* prevent trailing '/' */ |
249 | *end = '\0'; /* prevent trailing '/' */ | 255 | *cptr = '/'; |
250 | //bb_error_msg("replaced:'%s'", name); | 256 | //bb_error_msg("replaced:'%s'", name); |
251 | last_good = cptr; | 257 | last_good = cptr; |
252 | goto again; | 258 | goto again; |