svn commit: trunk/busybox: coreutils util-linux

vda at busybox.net vda at busybox.net
Fri Nov 9 17:31:19 PST 2007


Author: vda
Date: 2007-11-09 17:31:19 -0800 (Fri, 09 Nov 2007)
New Revision: 20398

Log:
readlink: realpath requires PATH_MAX, bb_common_bufsiz1 can be too small
umount: don't actually need char[2 * PATH_MAX] for realpath



Modified:
   trunk/busybox/coreutils/readlink.c
   trunk/busybox/util-linux/umount.c


Changeset:
Modified: trunk/busybox/coreutils/readlink.c
===================================================================
--- trunk/busybox/coreutils/readlink.c	2007-11-10 01:28:19 UTC (rev 20397)
+++ trunk/busybox/coreutils/readlink.c	2007-11-10 01:31:19 UTC (rev 20398)
@@ -8,7 +8,6 @@
  */
 
 #include <getopt.h>
-
 #include "libbb.h"
 
 int readlink_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
@@ -16,6 +15,7 @@
 {
 	char *buf;
 	char *fname;
+	char pathbuf[PATH_MAX];
 
 	USE_FEATURE_READLINK_FOLLOW(
 		unsigned opt;
@@ -34,7 +34,7 @@
 	logmode = LOGMODE_NONE;
 
 	if (opt) {
-		buf = realpath(fname, bb_common_bufsiz1);
+		buf = realpath(fname, pathbuf);
 	} else {
 		buf = xmalloc_readlink_or_warn(fname);
 	}

Modified: trunk/busybox/util-linux/umount.c
===================================================================
--- trunk/busybox/util-linux/umount.c	2007-11-10 01:28:19 UTC (rev 20397)
+++ trunk/busybox/util-linux/umount.c	2007-11-10 01:31:19 UTC (rev 20398)
@@ -25,7 +25,7 @@
 int umount_main(int argc, char **argv)
 {
 	int doForce;
-	char path[2*PATH_MAX];
+	char path[PATH_MAX + 2];
 	struct mntent me;
 	FILE *fp;
 	char *fstype = 0;
@@ -89,7 +89,7 @@
 
 		// Do we already know what to umount this time through the loop?
 		if (m)
-			safe_strncpy(path, m->dir, PATH_MAX);
+			safe_strncpy(path, m->dir, sizeof(path));
 		// For umount -a, end of mtab means time to exit.
 		else if (opt & OPT_ALL)
 			break;



More information about the busybox-cvs mailing list