From 9fa6ee76719b797ab06c38b01b3be24057f6a47b Mon Sep 17 00:00:00 2001 From: Poul-Henning Kamp Date: Sun, 13 Apr 1997 06:25:03 +0000 Subject: [PATCH] Though malloc allocates only cn.cn_namelen bytes for cn.cn_pnbuf in union_vn_create(), following bcopy copies cn.cn_namlen + 1 bytes to cn.cn_pnbuf PR: 3255 Reviewed by: phk Submitted by: kato --- sys/fs/unionfs/union_subr.c | 4 ++-- sys/miscfs/union/union_subr.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/fs/unionfs/union_subr.c b/sys/fs/unionfs/union_subr.c index a437b54d2911..8868b2a98aa0 100644 --- a/sys/fs/unionfs/union_subr.c +++ b/sys/fs/unionfs/union_subr.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * @(#)union_subr.c 8.20 (Berkeley) 5/20/95 - * $Id: union_subr.c,v 1.14 1997/02/22 09:40:40 peter Exp $ + * $Id: union_subr.c,v 1.15 1997/03/23 03:36:59 bde Exp $ */ #include @@ -895,7 +895,7 @@ union_vn_create(vpp, un, p) * copied in the first place). */ cn.cn_namelen = strlen(un->un_path); - cn.cn_pnbuf = (caddr_t) malloc(cn.cn_namelen, M_NAMEI, M_WAITOK); + cn.cn_pnbuf = (caddr_t) malloc(cn.cn_namelen+1, M_NAMEI, M_WAITOK); bcopy(un->un_path, cn.cn_pnbuf, cn.cn_namelen+1); cn.cn_nameiop = CREATE; cn.cn_flags = (LOCKPARENT|HASBUF|SAVENAME|SAVESTART|ISLASTCN); diff --git a/sys/miscfs/union/union_subr.c b/sys/miscfs/union/union_subr.c index a437b54d2911..8868b2a98aa0 100644 --- a/sys/miscfs/union/union_subr.c +++ b/sys/miscfs/union/union_subr.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * @(#)union_subr.c 8.20 (Berkeley) 5/20/95 - * $Id: union_subr.c,v 1.14 1997/02/22 09:40:40 peter Exp $ + * $Id: union_subr.c,v 1.15 1997/03/23 03:36:59 bde Exp $ */ #include @@ -895,7 +895,7 @@ union_vn_create(vpp, un, p) * copied in the first place). */ cn.cn_namelen = strlen(un->un_path); - cn.cn_pnbuf = (caddr_t) malloc(cn.cn_namelen, M_NAMEI, M_WAITOK); + cn.cn_pnbuf = (caddr_t) malloc(cn.cn_namelen+1, M_NAMEI, M_WAITOK); bcopy(un->un_path, cn.cn_pnbuf, cn.cn_namelen+1); cn.cn_nameiop = CREATE; cn.cn_flags = (LOCKPARENT|HASBUF|SAVENAME|SAVESTART|ISLASTCN);