Module Name:    src
Committed By:   maya
Date:           Fri Jan 20 02:25:24 UTC 2017

Modified Files:
        src/sys/dev/usb: ukbd.c

Log Message:
don't memcpy overlapping buffers, use memmove.
this is undefined behaviour.
CID 1299069


To generate a diff of this commit:
cvs rdiff -u -r1.135 -r1.136 src/sys/dev/usb/ukbd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/usb/ukbd.c
diff -u src/sys/dev/usb/ukbd.c:1.135 src/sys/dev/usb/ukbd.c:1.136
--- src/sys/dev/usb/ukbd.c:1.135	Fri Jan 20 02:22:42 2017
+++ src/sys/dev/usb/ukbd.c	Fri Jan 20 02:25:24 2017
@@ -1,4 +1,4 @@
-/*      $NetBSD: ukbd.c,v 1.135 2017/01/20 02:22:42 maya Exp $        */
+/*      $NetBSD: ukbd.c,v 1.136 2017/01/20 02:25:24 maya Exp $        */
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ukbd.c,v 1.135 2017/01/20 02:22:42 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ukbd.c,v 1.136 2017/01/20 02:25:24 maya Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -1004,7 +1004,7 @@ ukbd_cngetc(void *v, u_int *type, int *d
 	sc->sc_flags &= ~FLAG_POLLING;
 	c = sc->sc_pollchars[0];
 	sc->sc_npollchar--;
-	memcpy(sc->sc_pollchars, sc->sc_pollchars+1,
+	memmove(sc->sc_pollchars, sc->sc_pollchars+1,
 	       sc->sc_npollchar * sizeof(uint16_t));
 	*type = c & RELEASE ? WSCONS_EVENT_KEY_UP : WSCONS_EVENT_KEY_DOWN;
 	*data = c & CODEMASK;

Reply via email to