summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2017-05-30 07:40:25 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2017-05-30 07:40:25 +0000
commitdef6d835df8ef7186f4a9e02f0911bbfe939e469 (patch)
treeca4d9779a9c339510684d9df51efc3786b872178
parentecafd8f5ffa60d2e5fa042b8d7c4bb413178f76c (diff)
Use memmove() instead of memcpy(), buffers are overlapping.
From Coverity via NetBSD via miod@ ok claudio@, tedu@, deraadt@, krw@
-rw-r--r--sys/dev/hid/hidkbd.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/dev/hid/hidkbd.c b/sys/dev/hid/hidkbd.c
index c517b988aed..0f4694a6498 100644
--- a/sys/dev/hid/hidkbd.c
+++ b/sys/dev/hid/hidkbd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hidkbd.c,v 1.4 2017/05/12 09:16:55 mpi Exp $ */
+/* $OpenBSD: hidkbd.c,v 1.5 2017/05/30 07:40:24 mpi Exp $ */
/* $NetBSD: ukbd.c,v 1.85 2003/03/11 16:44:00 augustss Exp $ */
/*
@@ -494,7 +494,7 @@ hidkbd_cngetc(struct hidkbd *kbd, u_int *type, int *data)
c = kbd->sc_pollchars[0];
kbd->sc_npollchar--;
- memcpy(kbd->sc_pollchars, kbd->sc_pollchars+1,
+ memmove(kbd->sc_pollchars, kbd->sc_pollchars+1,
kbd->sc_npollchar * sizeof(u_int16_t));
*type = c & RELEASE ? WSCONS_EVENT_KEY_UP : WSCONS_EVENT_KEY_DOWN;
*data = c & CODEMASK;