PR/52522: ent_name is not necessarily 0 terminated, so check bounds.
XXX: pullup-8
This commit is contained in:
parent
d68621905c
commit
2252fe52a5
@ -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 @@ dkwedge_discover_gpt(struct disk *pdk, struct vnode *vp)
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user