From 4e5e717d72453bed761f561f24393d95d1817352 Mon Sep 17 00:00:00 2001 From: Artur Wojcik Date: Thu, 10 Dec 2009 12:03:40 -0700 Subject: 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 Signed-off-by: Dan Williams --- super-intel.c | 6 ++++++ 1 file changed, 6 insertions(+) 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; -- cgit