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>
This commit is contained in:
parent
d362da3dfe
commit
4e5e717d72
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue