From: heinzm@sourceware.org
To: dm-cvs@sourceware.org, dm-devel@redhat.com
Subject: dmraid/lib/format/ataraid jm.c
Date: 17 Sep 2009 09:21:08 -0000 [thread overview]
Message-ID: <20090917092108.25224.qmail@sourceware.org> (raw)
CVSROOT: /cvs/dm
Module name: dmraid
Changes by: heinzm@sourceware.org 2009-09-17 09:21:07
Modified files:
lib/format/ataraid: jm.c
Log message:
JMicron name termination fix
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/dmraid/lib/format/ataraid/jm.c.diff?cvsroot=dm&r1=1.4&r2=1.5
--- dmraid/lib/format/ataraid/jm.c 2008/06/20 21:52:17 1.4
+++ dmraid/lib/format/ataraid/jm.c 2009/09/17 09:21:07 1.5
@@ -25,18 +25,18 @@
static char *
name(struct lib_context *lc, struct raid_dev *rd, unsigned int subset)
{
- int i;
- size_t len;
+ size_t i, len;
struct jm *jm = META(rd, jm);
- char buf[JM_NAME_LEN + 1], *ret, *name = (char *) jm->name;
+ char *ret, *name = (char *) jm->name;
+ char buf[JM_NAME_LEN + 1] = { '\0' };
- /* Name always 0 terminated or whitespace at end ? */
+ /* Sanitize name, make sure it's null terminated */
strncpy(buf, name, JM_NAME_LEN);
- len = strlen(buf);
- i = len < JM_NAME_LEN ? len : JM_NAME_LEN;
- buf[i] = 0;
- while (i-- && isspace(buf[i]))
- buf[i] = 0;
+ while (i && isspace(buf[i])) {
+ name[i]='\0';
+ buf[i]='\0';
+ --i;
+ }
len = strlen(buf) + sizeof(HANDLER) + (jm->mode == JM_T_RAID01 ? 3 : 2);
if ((ret = dbg_malloc(len))) {
reply other threads:[~2009-09-17 9:21 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20090917092108.25224.qmail@sourceware.org \
--to=heinzm@sourceware.org \
--cc=dm-cvs@sourceware.org \
--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.