Source-Changes-HG archive

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

[src/trunk]: src/sys/dev Fix the size passed to memcpy, we only want 8 bytes....



details:   https://anonhg.NetBSD.org/src/rev/f286360efa08
branches:  trunk
changeset: 964986:f286360efa08
user:      maxv <maxv%NetBSD.org@localhost>
date:      Sun Aug 25 07:10:30 2019 +0000

description:
Fix the size passed to memcpy, we only want 8 bytes. Found by KASAN.

diffstat:

 sys/dev/sequencer.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 4a1b692c4715 -r f286360efa08 sys/dev/sequencer.c
--- a/sys/dev/sequencer.c       Sun Aug 25 06:06:48 2019 +0000
+++ b/sys/dev/sequencer.c       Sun Aug 25 07:10:30 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sequencer.c,v 1.70 2017/10/29 17:57:21 riastradh Exp $ */
+/*     $NetBSD: sequencer.c,v 1.71 2019/08/25 07:10:30 maxv Exp $      */
 
 /*
  * Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
@@ -55,7 +55,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sequencer.c,v 1.70 2017/10/29 17:57:21 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sequencer.c,v 1.71 2019/08/25 07:10:30 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "sequencer.h"
@@ -1290,7 +1290,7 @@
                return EINVAL;
        }
 #endif
-       memcpy(&sysex, b, sizeof sysex);
+       memcpy(&sysex, b, sizeof(*b));
        dev = sysex.device_no;
        if (/* dev < 0 || */ dev >= sc->nmidi)
                return (ENXIO);



Home | Main Index | Thread Index | Old Index