diff options
author | Randy Dunlap <randy.dunlap@oracle.com> | 2007-11-28 19:21:46 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-11-29 12:24:53 -0500 |
commit | d0eec99ce50baa5cc2ac02363cdb2a771ed4e1e2 (patch) | |
tree | 435b232daf15193124f2365882f5068b812e4449 /lib | |
parent | 6454d1f9038f708d7deef6270ed4ba5bb6e55869 (diff) |
hexdump: don't print bytes with bit 7 set
As Herbert Xu pointed out, bytes (chars) with bit 7 (0x80) set are true
with isprint() but they may not be isascii() but be Unicode instead, so
don't try to print them in hex dumps.
Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/hexdump.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/hexdump.c b/lib/hexdump.c index bd5edaeaa80b..343546550dc9 100644 --- a/lib/hexdump.c +++ b/lib/hexdump.c | |||
@@ -106,7 +106,8 @@ void hex_dump_to_buffer(const void *buf, size_t len, int rowsize, | |||
106 | while (lx < (linebuflen - 1) && lx < (ascii_column - 1)) | 106 | while (lx < (linebuflen - 1) && lx < (ascii_column - 1)) |
107 | linebuf[lx++] = ' '; | 107 | linebuf[lx++] = ' '; |
108 | for (j = 0; (j < rowsize) && (j < len) && (lx + 2) < linebuflen; j++) | 108 | for (j = 0; (j < rowsize) && (j < len) && (lx + 2) < linebuflen; j++) |
109 | linebuf[lx++] = isprint(ptr[j]) ? ptr[j] : '.'; | 109 | linebuf[lx++] = (isascii(ptr[j]) && isprint(ptr[j])) ? ptr[j] |
110 | : '.'; | ||
110 | nil: | 111 | nil: |
111 | linebuf[lx++] = '\0'; | 112 | linebuf[lx++] = '\0'; |
112 | } | 113 | } |