Print this page
SKU fix for 5094

@@ -410,35 +410,39 @@
 
 int
 smbios_info_chassis(smbios_hdl_t *shp, id_t id, smbios_chassis_t *chp)
 {
         const smb_struct_t *stp = smb_lookup_id(shp, id);
-        smb_chassis_t ch;
+        /* Length is measurable by one byte, so it'll be no more than 255. */
+        uint8_t buf[256]
+        smb_chassis_t *ch = (smb_chassis_t *)&(buf[0]);
 
         if (stp == NULL)
                 return (-1); /* errno is set for us */
 
         if (stp->smbst_hdr->smbh_type != SMB_TYPE_CHASSIS)
                 return (smb_set_errno(shp, ESMB_TYPE));
 
-        smb_info_bcopy(stp->smbst_hdr, &ch, sizeof (ch));
+        smb_info_bcopy(stp->smbst_hdr, ch, sizeof (buf));
         bzero(chp, sizeof (smbios_chassis_t));
 
-        chp->smbc_oemdata = ch.smbch_oemdata;
-        chp->smbc_lock = (ch.smbch_type & SMB_CHT_LOCK) != 0;
-        chp->smbc_type = ch.smbch_type & ~SMB_CHT_LOCK;
-        chp->smbc_bustate = ch.smbch_bustate;
-        chp->smbc_psstate = ch.smbch_psstate;
-        chp->smbc_thstate = ch.smbch_thstate;
-        chp->smbc_security = ch.smbch_security;
-        chp->smbc_uheight = ch.smbch_uheight;
-        chp->smbc_cords = ch.smbch_cords;
-        chp->smbc_elems = ch.smbch_cn;
-        chp->smbc_elemlen = ch.smbch_cm;
+        chp->smbc_oemdata = ch->smbch_oemdata;
+        chp->smbc_lock = (ch->smbch_type & SMB_CHT_LOCK) != 0;
+        chp->smbc_type = ch->smbch_type & ~SMB_CHT_LOCK;
+        chp->smbc_bustate = ch->smbch_bustate;
+        chp->smbc_psstate = ch->smbch_psstate;
+        chp->smbc_thstate = ch->smbch_thstate;
+        chp->smbc_security = ch->smbch_security;
+        chp->smbc_uheight = ch->smbch_uheight;
+        chp->smbc_cords = ch->smbch_cords;
+        chp->smbc_elems = ch->smbch_cn;
+        chp->smbc_elemlen = ch->smbch_cm;
 
-        if (shp->sh_smbvers >= SMB_VERSION_27)
-                chp->smbc_sku = smb_strptr(stp, ch.smbch_sku);
+        if (shp->sh_smbvers >= SMB_VERSION_27) {
+                (void) strlcpy(chp->smbc_sku, SMB_CH_SKU(ch),
+                    sizeof (chp->smbc_sku));
+        }
 
         return (0);
 }
 
 int