Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-9]: src/sys/dev/scsipi Pull up following revision(s) (requested b...
details: https://anonhg.NetBSD.org/src/rev/8772c1300a97
branches: netbsd-9
changeset: 369730:8772c1300a97
user: martin <martin%NetBSD.org@localhost>
date: Mon Aug 29 16:18:10 2022 +0000
description:
Pull up following revision(s) (requested by mlelstv in ticket #1509):
sys/dev/scsipi/sdvar.h: revision 1.40
sys/dev/scsipi/sd.c: revision 1.335
Don't fetch data beyond end of inquiry buffer, which, here, is not
NUL-terminated.
Reduce target buffer to needed size (product name + NUL terminator).
diffstat:
sys/dev/scsipi/sd.c | 9 ++++-----
sys/dev/scsipi/sdvar.h | 4 ++--
2 files changed, 6 insertions(+), 7 deletions(-)
diffs (48 lines):
diff -r 4bb0151331c3 -r 8772c1300a97 sys/dev/scsipi/sd.c
--- a/sys/dev/scsipi/sd.c Mon Aug 29 16:13:25 2022 +0000
+++ b/sys/dev/scsipi/sd.c Mon Aug 29 16:18:10 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sd.c,v 1.327.4.2 2021/02/11 12:53:28 martin Exp $ */
+/* $NetBSD: sd.c,v 1.327.4.3 2022/08/29 16:18:10 martin Exp $ */
/*-
* Copyright (c) 1998, 2003, 2004 The NetBSD Foundation, Inc.
@@ -47,7 +47,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sd.c,v 1.327.4.2 2021/02/11 12:53:28 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sd.c,v 1.327.4.3 2022/08/29 16:18:10 martin Exp $");
#ifdef _KERNEL_OPT
#include "opt_scsi.h"
@@ -254,9 +254,8 @@
SC_DEBUG(periph, SCSIPI_DB2, ("sdattach: "));
sd->type = (sa->sa_inqbuf.type & SID_TYPE);
- strncpy(sd->name, sa->sa_inqbuf.product, sizeof(sd->name));
-
- strncpy(sd->typename, sa->sa_inqbuf.product, sizeof(sd->typename));
+ memcpy(sd->name, sa->sa_inqbuf.product, uimin(16, sizeof(sd->name)));
+ memcpy(sd->typename, sa->sa_inqbuf.product, uimin(16, sizeof(sd->typename)));
if (sd->type == T_SIMPLE_DIRECT)
periph->periph_quirks |= PQUIRK_ONLYBIG | PQUIRK_NOBIGMODESENSE;
diff -r 4bb0151331c3 -r 8772c1300a97 sys/dev/scsipi/sdvar.h
--- a/sys/dev/scsipi/sdvar.h Mon Aug 29 16:13:25 2022 +0000
+++ b/sys/dev/scsipi/sdvar.h Mon Aug 29 16:18:10 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sdvar.h,v 1.39 2019/03/19 06:59:40 mlelstv Exp $ */
+/* $NetBSD: sdvar.h,v 1.39.4.1 2022/08/29 16:18:10 martin Exp $ */
/*-
* Copyright (c) 1998, 2004 The NetBSD Foundation, Inc.
@@ -88,7 +88,7 @@
callout_t sc_callout;
u_int8_t type;
char name[16]; /* product name, for default disklabel */
- char typename[128+4+1]; /* stored in disk info */
+ char typename[16+1]; /* stored in disk info */
};
#define SDGP_RESULT_OK 0 /* parameters obtained */
Home |
Main Index |
Thread Index |
Old Index