Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/dev/scsipi/libscsitest use strncpy() into a buffer tha...



details:   https://anonhg.NetBSD.org/src/rev/f033c639d131
branches:  trunk
changeset: 448647:f033c639d131
user:      mrg <mrg%NetBSD.org@localhost>
date:      Wed Feb 06 09:16:49 2019 +0000

description:
use strncpy() into a buffer that may not be nul terminated.

diffstat:

 tests/dev/scsipi/libscsitest/scsitest.c |  10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diffs (31 lines):

diff -r c1e177f251ee -r f033c639d131 tests/dev/scsipi/libscsitest/scsitest.c
--- a/tests/dev/scsipi/libscsitest/scsitest.c   Wed Feb 06 09:15:01 2019 +0000
+++ b/tests/dev/scsipi/libscsitest/scsitest.c   Wed Feb 06 09:16:49 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: scsitest.c,v 1.2 2014/04/25 00:24:39 pooka Exp $       */
+/*     $NetBSD: scsitest.c,v 1.3 2019/02/06 09:16:49 mrg Exp $ */
 
 /*
  * Copyright (c) 2010 Antti Kantee.  All Rights Reserved.
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: scsitest.c,v 1.2 2014/04/25 00:24:39 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: scsitest.c,v 1.3 2019/02/06 09:16:49 mrg Exp $");
 
 #include <sys/param.h>
 #include <sys/atomic.h>
@@ -123,9 +123,9 @@
                memset(inqbuf, 0, sizeof(*inqbuf));
                inqbuf->device = T_CDROM;
                inqbuf->dev_qual2 = SID_REMOVABLE;
-               strcpy(inqbuf->vendor, "RUMPHOBO");
-               strcpy(inqbuf->product, "It's a LIE");
-               strcpy(inqbuf->revision, "0.00");
+               strncpy(inqbuf->vendor, "RUMPHOBO", sizeof inqbuf->vendor);
+               strncpy(inqbuf->product, "It's a LIE", sizeof inqbuf->product);
+               strncpy(inqbuf->revision, "0.00", sizeof inqbuf->revision);
                break;
        }
        case READ_CD_CAPACITY: {



Home | Main Index | Thread Index | Old Index