diff options
author | phk <phk@FreeBSD.org> | 1997-04-13 06:25:03 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 1997-04-13 06:25:03 +0000 |
commit | 6191d4d12f8b04a35f97dc8ce2cd8f141b5cd696 (patch) | |
tree | d07bd451c43d57086cf43fad2341d7418a157af1 /sys | |
parent | a441df96834f98d75fdb876eb780f640465a8c6d (diff) | |
download | FreeBSD-src-6191d4d12f8b04a35f97dc8ce2cd8f141b5cd696.zip FreeBSD-src-6191d4d12f8b04a35f97dc8ce2cd8f141b5cd696.tar.gz |
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
Diffstat (limited to 'sys')
-rw-r--r-- | sys/fs/unionfs/union_subr.c | 4 | ||||
-rw-r--r-- | 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 a437b54..8868b2a 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 <sys/param.h> @@ -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 a437b54..8868b2a 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 <sys/param.h> @@ -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); |