freebsd-dev/sys/cam/scsi
Alan Somers 4195c7de24 Always null-terminate ccb_pathinq.(sim_vid|hba_vid|dev_name)
The sim_vid, hba_vid, and dev_name fields of struct ccb_pathinq are
fixed-length strings. AFAICT the only place they're read is in
sbin/camcontrol/camcontrol.c, which assumes they'll be null-terminated.
However, the kernel doesn't null-terminate them. A bunch of copy-pasted code
uses strncpy to write them, and doesn't guarantee null-termination. For at
least 4 drivers (mpr, mps, ciss, and hyperv), the hba_vid field actually
overflows. You can see the result by doing "camcontrol negotiate da0 -v".

This change null-terminates those fields everywhere they're set in the
kernel. It also shortens a few strings to ensure they'll fit within the
16-character field.

PR:		215474
Reported by:	Coverity
CID:		1009997 1010000 1010001 1010002 1010003 1010004 1010005
CID:		1331519 1010006 1215097 1010007 1288967 1010008 1306000
CID:		1211924 1010009 1010010 1010011 1010012 1010013 1010014
CID:		1147190 1010017 1010016 1010018 1216435 1010020 1010021
CID:		1010022 1009666 1018185 1010023 1010025 1010026 1010027
CID:		1010028 1010029 1010030 1010031 1010033 1018186 1018187
CID:		1010035 1010036 1010042 1010041 1010040 1010039
Reviewed by:	imp, sephe, slm
MFC after:	4 weeks
Sponsored by:	Spectra Logic Corp
Differential Revision:	https://reviews.freebsd.org/D9037
Differential Revision:	https://reviews.freebsd.org/D9038
2017-01-04 20:26:42 +00:00
..
scsi_all.c Improve length handling when writing sense data. 2016-12-24 17:42:34 +00:00
scsi_all.h Missed piece of r310640. 2016-12-27 22:28:14 +00:00
scsi_cd.c Add label annotations to CAM sysctls. 2016-12-14 12:53:33 +00:00
scsi_cd.h Add CD/DVD Capabilities and Mechanical Status Page. 2015-09-29 09:09:37 +00:00
scsi_ch.c chdone(): Prevent returning uninitialized scalar value. 2016-04-07 21:33:14 +00:00
scsi_ch.h sys/cam: spelling fixes in comments. 2016-04-29 21:05:48 +00:00
scsi_da.c Add label annotations to CAM sysctls. 2016-12-14 12:53:33 +00:00
scsi_da.h Improve support for informational exceptions. 2016-12-19 10:25:47 +00:00
scsi_dvcfg.h
scsi_enc_internal.h Merge CAM locking changes from the projects/camlock branch to radically 2013-10-21 12:00:26 +00:00
scsi_enc_safte.c Allow sleepable allocations in enclosure daemon threads. 2016-05-10 16:20:36 +00:00
scsi_enc_ses.c Make SES status updates more aggressive. 2016-11-29 13:48:36 +00:00
scsi_enc.c Convert sys/cam to use make_dev_s(). 2016-01-07 20:22:55 +00:00
scsi_enc.h Add API to obtain primary enclosure name and ID for /dev/sesX devices. 2015-11-21 10:22:01 +00:00
scsi_iu.h
scsi_low.c Always null-terminate ccb_pathinq.(sim_vid|hba_vid|dev_name) 2017-01-04 20:26:42 +00:00
scsi_low.h sys/cam: spelling fixes in comments. 2016-04-29 21:05:48 +00:00
scsi_message.h Add partial support for QUERY TMF to CAM and isp(4). 2015-10-23 18:34:18 +00:00
scsi_pass.c cam: Zero bio pointer in user-supplied SCSI CCBs 2016-11-08 21:17:24 +00:00
scsi_pass.h Add asynchronous command support to the pass(4) driver, and the new 2015-12-03 20:54:55 +00:00
scsi_pt.c Convert sys/cam to use make_dev_s(). 2016-01-07 20:22:55 +00:00
scsi_pt.h
scsi_sa.c Add label annotations to CAM sysctls. 2016-12-14 12:53:33 +00:00
scsi_sa.h Fix a couple of problems in the sa(4) media type reports. 2015-03-18 20:52:34 +00:00
scsi_ses.h Add support for EIIOE flag in Additional Element Status. 2016-11-07 18:21:53 +00:00
scsi_sg.c Convert sys/cam to use make_dev_s(). 2016-01-07 20:22:55 +00:00
scsi_sg.h Overhaul CAM SG driver IOCTL interfaces. 2014-06-02 19:53:53 +00:00
scsi_targ_bh.c Merge CAM locking changes from the projects/camlock branch to radically 2013-10-21 12:00:26 +00:00
scsi_target.c Make pass, sg and targ drivers respect HBA's maxio. 2015-09-30 13:31:37 +00:00
scsi_targetio.h
scsi_xpt.c Fix "camcontrol rescan" with SATA drives behind a SAS controller 2016-11-17 20:42:56 +00:00
smp_all.c sys: use our nitems() macro when param.h is available. 2016-04-21 19:40:10 +00:00
smp_all.h