Module Name: src
Committed By: jakllsch
Date: Tue Feb 21 02:22:54 UTC 2012
Modified Files:
src/sbin/scsictl: scsi_subr.c
Log Message:
Prevent stack buffer overflow when copying too-large-CDB into request.
To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sbin/scsictl/scsi_subr.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sbin/scsictl/scsi_subr.c
diff -u src/sbin/scsictl/scsi_subr.c:1.13 src/sbin/scsictl/scsi_subr.c:1.14
--- src/sbin/scsictl/scsi_subr.c:1.13 Tue Feb 21 02:19:41 2012
+++ src/sbin/scsictl/scsi_subr.c Tue Feb 21 02:22:54 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: scsi_subr.c,v 1.13 2012/02/21 02:19:41 jakllsch Exp $ */
+/* $NetBSD: scsi_subr.c,v 1.14 2012/02/21 02:22:54 jakllsch Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: scsi_subr.c,v 1.13 2012/02/21 02:19:41 jakllsch Exp $");
+__RCSID("$NetBSD: scsi_subr.c,v 1.14 2012/02/21 02:22:54 jakllsch Exp $");
#endif
@@ -66,6 +66,7 @@ scsi_command(int fd, const void *cmd, si
memset(&req, 0, sizeof(req));
+ cmdlen = MIN(cmdlen, sizeof(req.cmd));
memcpy(req.cmd, cmd, cmdlen);
req.cmdlen = cmdlen;
req.databuf = data;