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
This commit is contained in:
parent
ae9d2b47e0
commit
9fa6ee7671
@ -35,7 +35,7 @@
|
|||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* @(#)union_subr.c 8.20 (Berkeley) 5/20/95
|
* @(#)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>
|
#include <sys/param.h>
|
||||||
@ -895,7 +895,7 @@ union_vn_create(vpp, un, p)
|
|||||||
* copied in the first place).
|
* copied in the first place).
|
||||||
*/
|
*/
|
||||||
cn.cn_namelen = strlen(un->un_path);
|
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);
|
bcopy(un->un_path, cn.cn_pnbuf, cn.cn_namelen+1);
|
||||||
cn.cn_nameiop = CREATE;
|
cn.cn_nameiop = CREATE;
|
||||||
cn.cn_flags = (LOCKPARENT|HASBUF|SAVENAME|SAVESTART|ISLASTCN);
|
cn.cn_flags = (LOCKPARENT|HASBUF|SAVENAME|SAVESTART|ISLASTCN);
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* @(#)union_subr.c 8.20 (Berkeley) 5/20/95
|
* @(#)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>
|
#include <sys/param.h>
|
||||||
@ -895,7 +895,7 @@ union_vn_create(vpp, un, p)
|
|||||||
* copied in the first place).
|
* copied in the first place).
|
||||||
*/
|
*/
|
||||||
cn.cn_namelen = strlen(un->un_path);
|
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);
|
bcopy(un->un_path, cn.cn_pnbuf, cn.cn_namelen+1);
|
||||||
cn.cn_nameiop = CREATE;
|
cn.cn_nameiop = CREATE;
|
||||||
cn.cn_flags = (LOCKPARENT|HASBUF|SAVENAME|SAVESTART|ISLASTCN);
|
cn.cn_flags = (LOCKPARENT|HASBUF|SAVENAME|SAVESTART|ISLASTCN);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user