Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/bluetooth CID 1293640/1 memory corruption/overrun



details:   https://anonhg.NetBSD.org/src/rev/c13060976972
branches:  trunk
changeset: 337485:c13060976972
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Apr 16 19:53:19 2015 +0000

description:
CID 1293640/1 memory corruption/overrun

diffstat:

 sys/dev/bluetooth/btmagic.c |  9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diffs (37 lines):

diff -r f752d8130761 -r c13060976972 sys/dev/bluetooth/btmagic.c
--- a/sys/dev/bluetooth/btmagic.c       Thu Apr 16 15:17:17 2015 +0000
+++ b/sys/dev/bluetooth/btmagic.c       Thu Apr 16 19:53:19 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: btmagic.c,v 1.12 2015/04/06 17:45:31 bouyer Exp $      */
+/*     $NetBSD: btmagic.c,v 1.13 2015/04/16 19:53:19 christos Exp $    */
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -85,7 +85,7 @@
  *****************************************************************************/
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: btmagic.c,v 1.12 2015/04/06 17:45:31 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: btmagic.c,v 1.13 2015/04/16 19:53:19 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/conf.h>
@@ -1523,6 +1523,8 @@
                                 */
                                 continue;
                        }
+                       if (id >= __arraycount(sc->sc_ax))
+                               continue;
                                        
                        tx = ax - sc->sc_ax[id];
                        ty = ay - sc->sc_ay[id];
@@ -1562,6 +1564,9 @@
                        break;
                }
 
+               if (id >= __arraycount(sc->sc_ax))
+                       continue;
+
                sc->sc_ax[id] = ax;
                sc->sc_ay[id] = ay;
        }



Home | Main Index | Thread Index | Old Index