svn commit: trunk/busybox/coreutils

vda at busybox.net vda at busybox.net
Sat Jul 26 19:34:00 UTC 2008


Author: vda
Date: 2008-07-26 12:34:00 -0700 (Sat, 26 Jul 2008)
New Revision: 22956

Log:
tr: fix "access past the end of a string" bug 4354



Modified:
   trunk/busybox/coreutils/tr.c


Changeset:
Modified: trunk/busybox/coreutils/tr.c
===================================================================
--- trunk/busybox/coreutils/tr.c	2008-07-26 18:35:10 UTC (rev 22955)
+++ trunk/busybox/coreutils/tr.c	2008-07-26 19:34:00 UTC (rev 22956)
@@ -138,7 +138,7 @@
 				arg += 3;	/* skip CHAR=] */
 				continue;
 			}
-			if (*arg != '-') { /* not [x-...] - copy verbatim */
+			if (i == '\0' || *arg != '-') { /* not [x-...] - copy verbatim */
 				*buffer++ = '[';
 				arg--; /* points to x */
 				continue; /* copy all, including eventual ']' */




More information about the busybox-cvs mailing list