svn commit: trunk/busybox/procps

vda at busybox.net vda at busybox.net
Thu Jan 8 03:35:48 UTC 2009


Author: vda
Date: 2009-01-08 03:35:47 +0000 (Thu, 08 Jan 2009)
New Revision: 24716

Log:
sysctl: fix another corner case with "dots and slashes"



Modified:
   trunk/busybox/procps/sysctl.c


Changeset:
Modified: trunk/busybox/procps/sysctl.c
===================================================================
--- trunk/busybox/procps/sysctl.c	2009-01-06 23:38:33 UTC (rev 24715)
+++ trunk/busybox/procps/sysctl.c	2009-01-08 03:35:47 UTC (rev 24716)
@@ -233,6 +233,12 @@
 	 * 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 @@
 			*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;



More information about the busybox-cvs mailing list