[Dmraid-debian-commits] [SCM] Maintenance of the dmraid package branch, master, updated. debian/1.0.0.rc15-3-1-g546b293

Giuseppe Iuculano giuseppe at iuculano.it
Fri Mar 20 13:38:04 UTC 2009


The following commit has been merged in the master branch:
commit 546b29311a6e7db3cf97344d04ff615b38f5b6bb
Author: Giuseppe Iuculano <giuseppe at iuculano.it>
Date:   Fri Mar 20 14:36:35 2009 +0100

    debian/patches/05_jmicron-name-fix.patch: Fix segfault when attempting to generate name for jmicron controllers. Thanks to danwood76 (LP: #344215)

diff --git a/debian/patches/05_jmicron-name-fix.patch b/debian/patches/05_jmicron-name-fix.patch
new file mode 100644
index 0000000..ad1a45d
--- /dev/null
+++ b/debian/patches/05_jmicron-name-fix.patch
@@ -0,0 +1,33 @@
+Fix segfault when attempting to generate name for jmicron controllers.
+LP #344215
+--- a/1.0.0.rc15/lib/format/ataraid/jm.c
++++ b/1.0.0.rc15/lib/format/ataraid/jm.c
+@@ -25,18 +25,19 @@ static int member(struct jm *jm);
+ static char *
+ name(struct lib_context *lc, struct raid_dev *rd, unsigned int subset)
+ {
+-	int i;
++	size_t i = JM_NAME_LEN-1;
+ 	size_t 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 ? */
+-	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;
++	/* Sanitize name, make sure it's null terminated */
++	strncpy(buf, jm->name, JM_NAME_LEN);
++	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))) {
diff --git a/debian/patches/series b/debian/patches/series
index 79fbaaf..8d13e17 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -2,6 +2,7 @@
 02_scsi_serial_remove_ws.patch
 03_fix_hyphen-used-as-minus-sign.patch
 04_do_not_use_p_for_partition.patch
+05_jmicron-name-fix.patch
 06_fix_led_support_compilation.patch
 07_isw_metadata_normal_state.patch
 08_isw_rebuild.patch

-- 
Maintenance of the dmraid package



More information about the Dmraid-debian-commits mailing list