Artur Wojcik: Fix for NULL pointer dereference defect.

Martin F. Krafft madduck at alioth.debian.org
Wed Jan 27 02:03:52 UTC 2010


Module: mdadm
Branch: upstream
Commit: 4e5e717d72453bed761f561f24393d95d1817352
URL:    http://git.debian.org/?p=pkg-mdadm/mdadm.git;a=commit;h=4e5e717d72453bed761f561f24393d95d1817352

Author: Artur Wojcik <artur.wojcik at intel.com>
Date:   Thu Dec 10 12:03:40 2009 -0700

Fix for NULL pointer dereference defect.

Pointer 'c' returned from call to function 'strchr' at line 954 may
be NULL and will be dereferenced at line 955.

Signed-off-by: Artur Wojcik <artur.wojcik at intel.com>
Signed-off-by: Dan Williams <dan.j.williams at intel.com>

---

 super-intel.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/super-intel.c b/super-intel.c
index da753a0..72fa68f 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -961,6 +961,12 @@ static int imsm_enumerate_ports(const char *hba_path, int port_count, int host_b
 
 		/* chop device path to 'host%d' and calculate the port number */
 		c = strchr(&path[hba_len], '/');
+		if (!c) {
+			if (verbose)
+				fprintf(stderr, Name ": %s - invalid path name\n", path + hba_len);
+			err = 2;
+			break;
+		}
 		*c = '\0';
 		if (sscanf(&path[hba_len], "host%d", &port) == 1)
 			port -= host_base;




More information about the pkg-mdadm-commits mailing list