summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Fiddaman <omnios@citrus-it.co.uk>2018-03-19 15:16:59 +0000
committerDan McDonald <danmcd@joyent.com>2018-03-20 14:42:19 -0400
commit14ae03cbd0ae825189ca16e280cef1759c76f949 (patch)
tree0a1d92799fca6a64c1ab072ef48cc0842afa5037
parent015f38bba18ec2acb8888f945aa30883d339367b (diff)
downloadillumos-joyent-14ae03cbd0ae825189ca16e280cef1759c76f949.tar.gz
9317 FMD crashes with zero-length allocation
Reviewed by: C Fraire <cfraire@me.com> Reviewed by: Ken Mays <maybird1776@yahoo.com> Reviewed by: Igor Kozhukhov <igor@dilos.org> Reviewed by: Toomas Soome <tsoome@me.com> Approved by: Dan McDonald <danmcd@joyent.com>
-rw-r--r--usr/src/lib/scsi/plugins/ses/ses2/common/ses2_element.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/usr/src/lib/scsi/plugins/ses/ses2/common/ses2_element.c b/usr/src/lib/scsi/plugins/ses/ses2/common/ses2_element.c
index f6c71b4743..3b53e3294f 100644
--- a/usr/src/lib/scsi/plugins/ses/ses2/common/ses2_element.c
+++ b/usr/src/lib/scsi/plugins/ses/ses2/common/ses2_element.c
@@ -21,11 +21,10 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2018 OmniOS Community Edition (OmniOSce) Association.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <sys/types.h>
#include <stddef.h>
#include <stdio.h>
@@ -872,6 +871,9 @@ elem_parse_aes_misc(const ses2_aes_descr_eip_impl_t *dep, nvlist_t *nvl,
(len - offsetof(ses2_aes_descr_sas1_impl_t,
sadsi_phys)) / sizeof (ses2_aes_phy1_descr_impl_t));
+ if (nphy == 0)
+ return (0);
+
nva = ses_zalloc(nphy * sizeof (nvlist_t *));
if (nva == NULL)
return (-1);