Blob Blame History Raw
From 563d63dbf762c41f908b5e10deb1b115def93bcc Mon Sep 17 00:00:00 2001
From: Theodore Ts'o <tytso@mit.edu>
Date: Tue, 26 Mar 2019 09:36:53 -0400
Subject: [PATCH 4/4] debugfs: fix printing of xattrs with ea_in_inode values

Due to a missing "else" debugfs was printing (garbage) from the xattr
buffer which could potentially overrun the end of the buffer.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
 debugfs/xattrs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/debugfs/xattrs.c b/debugfs/xattrs.c
index c29761ec..dde9af2f 100644
--- a/debugfs/xattrs.c
+++ b/debugfs/xattrs.c
@@ -448,7 +448,7 @@ static void dump_xattr_raw_entries(FILE *f, unsigned char *buf,
 		else if (ent.e_value_offs >= len ||
 			 (vstart + ent.e_value_size) > len)
 			fprintf(f, "<runs off end>");
-		if (is_mostly_printable((char *)(buf + vstart),
+		else if (is_mostly_printable((char *)(buf + vstart),
 					ent.e_value_size))
 			safe_print(f, (char *)(buf + vstart),
 				   ent.e_value_size);
-- 
2.20.1