summaryrefslogtreecommitdiffstats
path: root/super-intel.c
diff options
context:
space:
mode:
authorArtur Wojcik <artur.wojcik@intel.com>2009-12-10 12:03:40 -0700
committerDan Williams <dan.j.williams@intel.com>2009-12-10 12:03:40 -0700
commit4e5e717d72453bed761f561f24393d95d1817352 (patch)
tree45c045a22d5c9c61be4c04c3587e5f8519f77ff9 /super-intel.c
parentd362da3dfef78f016690e677052b20a163e65236 (diff)
downloadmdadm-4e5e717d72453bed761f561f24393d95d1817352.tar.gz
mdadm-4e5e717d72453bed761f561f24393d95d1817352.tar.xz
mdadm-4e5e717d72453bed761f561f24393d95d1817352.zip
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@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'super-intel.c')
-rw-r--r--super-intel.c6
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;