Whamcloud - gitweb
debugfs: fix "ls -p" to avoid printing garbage after the file name
authorTheodore Ts'o <tytso@mit.edu>
Mon, 24 Jul 2017 17:11:16 +0000 (13:11 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 24 Jul 2017 17:11:16 +0000 (13:11 -0400)
commitb55571cdf7206b780ff4116ca975fd8d3af5f353
tree9f84b249f14fc46529eec2d25b28f78d8f69fff7
parent7d8f358cdce948df57b1001b9c278f33519afa86
debugfs: fix "ls -p" to avoid printing garbage after the file name

In commit 68a1de3df3 (debugfs: pretty print encrypted filenames in the
ls command), a change was introduced in debugfs/ls.c which instead of
copying dirent->name and 0-terminating it, dirent->name is used
directly in printf.

However, instead of using the precision to limit the number of
characters output, the code uses the field width. As a result,
characters are output until a 0 is read, which results in garbage
after the file name.

Also fix two other instances of this in debugging messages that aren't
used, but fixing them will avoid potential future copypasta bugs.

Reported-by: Christian Gabriel <ch_gabriel@web.de>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
debugfs/ls.c
lib/blkid/read.c
lib/ext2fs/namei.c