All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jun'ichi Nomura" <j-nomura@ce.jp.nec.com>
To: device-mapper development <dm-devel@redhat.com>,
	Alasdair Kergon <agk@redhat.com>
Subject: [PATCH] dmsetup: fix 'dmsetup status' for crypt filling '0' in wrong area
Date: Fri, 20 Apr 2007 12:07:04 -0400	[thread overview]
Message-ID: <4628E528.1070900@ce.jp.nec.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 438 bytes --]

Hi,

dmsetup tries to suppress encryption key of crypt target in the table
by filling '0' in params buffer.
However, the code assumes the case for showing table only and will
fill '0' beyond the params buffer when it's showing status, where
the params is "".

The patch fixes it.
The suppression is not necessary for showing status as
no encryption key is included in status line.

Thanks,
-- 
Jun'ichi Nomura, NEC Corporation of America

[-- Attachment #2: dmsetup-status-crypt-suppression-bug.patch --]
[-- Type: text/x-patch, Size: 866 bytes --]

dmsetup tries to suppress encryption key of crypt target.
However, the code overruns the params buffer if the command
is showing 'status', in that case params is "".

---
 dmsetup/dmsetup.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Index: device-mapper.work/dmsetup/dmsetup.c
===================================================================
--- device-mapper.work.orig/dmsetup/dmsetup.c
+++ device-mapper.work/dmsetup/dmsetup.c
@@ -964,12 +964,14 @@ static int _status(int argc, char **argv
 			if (target_type) {
 
 			/* Suppress encryption key */
-			if (!_switches[SHOWKEYS_ARG] &&
+			if (cmd == DM_DEVICE_TABLE &&
+			    !_switches[SHOWKEYS_ARG] &&
 			    !strcmp(target_type, "crypt")) {
 				c = params;
 				while (*c && *c != ' ')
 					c++;
-				c++;
+				if (*c)
+					c++;
 				while (*c && *c != ' ')
 					*c++ = '0';
 			}

[-- Attachment #3: Type: text/plain, Size: 0 bytes --]



             reply	other threads:[~2007-04-20 16:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-20 16:07 Jun'ichi Nomura [this message]
2007-06-04 16:21 ` dmeventd - High level documentation, any kind of design documents Wood, Brian J

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4628E528.1070900@ce.jp.nec.com \
    --to=j-nomura@ce.jp.nec.com \
    --cc=agk@redhat.com \
    --cc=dm-devel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.