summaryrefslogtreecommitdiff
path: root/tools/getfattr.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/getfattr.c')
-rw-r--r--tools/getfattr.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/getfattr.c b/tools/getfattr.c
index 72a8852..0ba5781 100644
--- a/tools/getfattr.c
+++ b/tools/getfattr.c
@@ -110,6 +110,10 @@ int well_enough_printable(const char *value, size_t size)
{
size_t n, nonpr = 0;
+ /* Don't count the NULL terminator if there is one */
+ if (size && !value[size - 1])
+ size--;
+
for (n=0; n < size; n++)
if (!isprint(*value++))
nonpr++;