public inbox for lvm2-cvs@sourceware.org help / color / mirror / Atom feed
From: prajnoha@sourceware.org To: lvm-devel@redhat.com, lvm2-cvs@sourceware.org Subject: LVM2 ./WHATS_NEW_DM libdm/libdm-common.c libdm ... Date: Wed, 07 Jan 2009 12:17:00 -0000 [thread overview] Message-ID: <20090107121740.15222.qmail@sourceware.org> (raw) CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: prajnoha@sourceware.org 2009-01-07 12:17:40 Modified files: . : WHATS_NEW_DM libdm : libdm-common.c libdm/ioctl : libdm-iface.c Log message: Add checks for device names in dmsetup and show proper error messages. Checks added for DM device names to allow only names < DM_NAME_LEN, otherwise a part of lengthy name would be silently ignored and could cause confusion while using dmsetup. Also, the name should not contain '/' character, if it is used in context of creating a new device or renaming the existing one (because we do not consider full path to devices, they do not exist in filesystem yet) and appropriate error messages are shown. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW_DM.diff?cvsroot=lvm2&r1=1.258&r2=1.259 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdm-common.c.diff?cvsroot=lvm2&r1=1.63&r2=1.64 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/ioctl/libdm-iface.c.diff?cvsroot=lvm2&r1=1.54&r2=1.55 --- LVM2/WHATS_NEW_DM 2008/12/11 16:25:51 1.258 +++ LVM2/WHATS_NEW_DM 2009/01/07 12:17:40 1.259 @@ -1,5 +1,6 @@ Version 1.02.30 - ==================================== + Add checks for device names in dmsetup and show proper error messages. Replace _dm_snprintf with EMIT_PARAMS macro for creating target lines Version 1.02.29 - 10th November 2008 --- LVM2/libdm/libdm-common.c 2008/11/04 15:07:45 1.63 +++ LVM2/libdm/libdm-common.c 2009/01/07 12:17:40 1.64 @@ -143,18 +143,27 @@ * as its last component. */ if ((pos = strrchr(name, '/'))) { + if (dmt->type == DM_DEVICE_CREATE) { + log_error("Name \"%s\" invalid. It contains \"/\".", name); + return 0; + } + snprintf(path, sizeof(path), "%s/%s", _dm_dir, pos + 1); if (stat(name, &st1) || stat(path, &st2) || !(st1.st_dev == st2.st_dev)) { - log_error("dm_task_set_name: Device %s not found", - name); + log_error("Device %s not found", name); return 0; } name = pos + 1; } + if (strlen(name) >= DM_NAME_LEN) { + log_error("Name \"%s\" too long", name); + return 0; + } + if (!(dmt->dev_name = dm_strdup(name))) { log_error("dm_task_set_name: strdup(%s) failed", name); return 0; --- LVM2/libdm/ioctl/libdm-iface.c 2008/11/03 18:59:59 1.54 +++ LVM2/libdm/ioctl/libdm-iface.c 2009/01/07 12:17:40 1.55 @@ -1018,6 +1018,16 @@ int dm_task_set_newname(struct dm_task *dmt, const char *newname) { + if (strchr(newname, '/')) { + log_error("Name \"%s\" invalid. It contains \"/\".", newname); + return 0; + } + + if (strlen(newname) >= DM_NAME_LEN) { + log_error("Name \"%s\" too long", newname); + return 0; + } + if (!(dmt->newname = dm_strdup(newname))) { log_error("dm_task_set_newname: strdup(%s) failed", newname); return 0;
next reply other threads:[~2009-01-07 12:17 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2009-01-07 12:17 prajnoha [this message] 2011-03-02 0:29 agk 2011-11-18 19:34 zkabelac 2012-01-09 12:26 zkabelac 2012-03-05 12:43 prajnoha 2012-03-05 12:48 prajnoha
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=20090107121740.15222.qmail@sourceware.org \ --to=prajnoha@sourceware.org \ --cc=lvm-devel@redhat.com \ --cc=lvm2-cvs@sourceware.org \ /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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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 read-only IMAP folder(s) and NNTP newsgroup(s).