[BusyBox] [PATCH] - Fixing libbb/dump.c:conv_u

Felipe Kellermann stdfk at terra.com.br
Fri May 28 20:11:02 UTC 2004


Package: busybox
Version: v1.00-pre10 (2004.05.28-17:04+0000)

The current version of `conv_u' (libbb/dump.c:conv_u) is broken.  There is
a call to printf using `*pr-cchar' referencing a string and using a single
char, when *p <= 0x1f.  I have also replaced those underscores used in the
list by additional NUL

-- 
Felipe Kellermann
-------------- next part --------------
Index: libbb/dump.c
===================================================================
RCS file: /var/cvs/busybox/libbb/dump.c,v
retrieving revision 1.12
diff -u -3 -p -b -w -u -r1.12 dump.c
--- a/libbb/dump.c	2 May 2004 08:38:53 -0000	1.12
+++ b/libbb/dump.c	28 May 2004 20:02:25 -0000
@@ -490,16 +490,15 @@ static void conv_c(PR * pr, u_char * p)
 
 static void conv_u(PR * pr, u_char * p)
 {
-	static const char list[] =
+	const char list[] =
 		"nul\0soh\0stx\0etx\0eot\0enq\0ack\0bel\0"
-		"bs\0_ht\0_lf\0_vt\0_ff\0_cr\0_so\0_si\0_"
+		"bs\0\0ht\0\0nl\0\0vt\0\0ff\0\0cr\0\0so\0\0si\0\0"
 		"dle\0dcl\0dc2\0dc3\0dc4\0nak\0syn\0etb\0"
-		"can\0em\0_sub\0esc\0fs\0_gs\0_rs\0_us";
+		"can\0em\0\0sub\0esc\0fs\0\0gs\0\0rs\0\0us";
 
-	/* od used nl, not lf */
 	if (*p <= 0x1f) {
 		*pr->cchar = 's';
-		printf(pr->fmt, list[4 * (int)(*p)]);
+		printf(pr->fmt, list + (4 * (int)*p));
 	} else if (*p == 0x7f) {
 		*pr->cchar = 's';
 		printf(pr->fmt, "del");


More information about the busybox mailing list