Skip to contentSkip to conversation

reiser4progs: Limit printing of label to the maximum of 16 chars

PATCH New Edward Shishkin 1 participant 1 message May 3, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 2/6 reiser4progs: Limit printing of label to the maximum of 16 chars

From: Mike Fleetwood <[email protected]>

For a reiser4 file system with exactly the maximum size 16 character label, debugfs.reiser4 prints junk from memory at the end of the label. This is because the label is read into a 16 character array and is printed as a string, but there isn't a nul terminating character.

    # mkfs.reiser4 --yes --label abcdefghij123456 /dev/sda13
    # debugfs.reiser4 /dev/sda13 2> /dev/null | grep label:
    label:          abcdefghij123456!

Print at most 16 characters of the label.

---
 librepair/master.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
librepair/master.c +1 -1
@@ -356,7 +356,7 @@ void repair_master_print(reiser4_master_
 #endif
 	
 	if (*master->ent.ms_label != '\0') {
-		aal_stream_format(stream, "label:\t\t%s\n",
+		aal_stream_format(stream, "label:\t\t%.16s\n",
 				  reiser4_master_get_label(master));
 	} else {
 		aal_stream_format(stream, "label:\t\t<none>\n");