reiserfs-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] reiser4progs: Limit printing of label to the maximum of 16 chars
@ 2012-12-29 14:17 Mike Fleetwood
  0 siblings, 0 replies; only message in thread
From: Mike Fleetwood @ 2012-12-29 14:17 UTC (permalink / raw)
  To: reiserfs-devel

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.

Signed-off-by: Mike Fleetwood <mike.fleetwood@googlemail.com>
---

diff -urN reiser4progs-1.0.7.orig/librepair/master.c reiser4progs-1.0.7/librepair/master.c
--- reiser4progs-1.0.7.orig/librepair/master.c	2009-01-08 21:34:27.000000000 +0000
+++ reiser4progs-1.0.7/librepair/master.c	2012-12-29 13:34:51.000000000 +0000
@@ -356,7 +356,7 @@
 #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");

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-12-29 14:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-29 14:17 [PATCH] reiser4progs: Limit printing of label to the maximum of 16 chars Mike Fleetwood

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).