Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/dkwedge PR/52522: ent_name is not necessarily 0 term...



details:   https://anonhg.NetBSD.org/src/rev/c5f1dec7a98b
branches:  trunk
changeset: 356165:c5f1dec7a98b
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Sep 06 18:21:17 2017 +0000

description:
PR/52522: ent_name is not necessarily 0 terminated, so check bounds.
XXX: pullup-8

diffstat:

 sys/dev/dkwedge/dkwedge_gpt.c |  7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diffs (28 lines):

diff -r 324d2d8b0a92 -r c5f1dec7a98b sys/dev/dkwedge/dkwedge_gpt.c
--- a/sys/dev/dkwedge/dkwedge_gpt.c     Wed Sep 06 18:17:18 2017 +0000
+++ b/sys/dev/dkwedge/dkwedge_gpt.c     Wed Sep 06 18:21:17 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dkwedge_gpt.c,v 1.18 2017/01/19 00:44:40 maya Exp $    */
+/*     $NetBSD: dkwedge_gpt.c,v 1.19 2017/09/06 18:21:17 christos Exp $        */
 
 /*-
  * Copyright (c) 2004 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dkwedge_gpt.c,v 1.18 2017/01/19 00:44:40 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dkwedge_gpt.c,v 1.19 2017/09/06 18:21:17 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -252,7 +252,8 @@
                else {
                        c = dkw.dkw_wname;
                        r = sizeof(dkw.dkw_wname) - 1;
-                       for (j = 0; ent->ent_name[j] != 0x0000; j++) {
+                       for (j = 0; j < sizeof(ent->ent_name)
+                           && ent->ent_name[j] != 0x0000; j++) {
                                n = wput_utf8(c, r, le16toh(ent->ent_name[j]));
                                if (n == 0)
                                        break;



Home | Main Index | Thread Index | Old Index