diff options
author | rodrigc <rodrigc@FreeBSD.org> | 2007-07-13 18:51:08 +0000 |
---|---|---|
committer | rodrigc <rodrigc@FreeBSD.org> | 2007-07-13 18:51:08 +0000 |
commit | 85690ea86184fd1c1c409923a46d7c74e26ba272 (patch) | |
tree | 55da11a0cf9ff3fc57ab3d7b490e7daa1bb7adca /sys | |
parent | 7d88dba46f7470a5d73288edc1d96de39273281d (diff) | |
download | FreeBSD-src-85690ea86184fd1c1c409923a46d7c74e26ba272.zip FreeBSD-src-85690ea86184fd1c1c409923a46d7c74e26ba272.tar.gz |
Perform range check before allocating memory when reading
extended attributes.
Reviewed by: kib
Approved by: re (hrs)
PR: 114389
Diffstat (limited to 'sys')
-rw-r--r-- | sys/ufs/ffs/ffs_vnops.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/sys/ufs/ffs/ffs_vnops.c b/sys/ufs/ffs/ffs_vnops.c index b187ad7..7792cc4 100644 --- a/sys/ufs/ffs/ffs_vnops.c +++ b/sys/ufs/ffs/ffs_vnops.c @@ -1192,14 +1192,18 @@ ffs_rdextattr(u_char **p, struct vnode *vp, struct thread *td, int extra) { struct inode *ip; struct ufs2_dinode *dp; + struct fs *fs; struct uio luio; struct iovec liovec; int easize, error; u_char *eae; ip = VTOI(vp); + fs = ip->i_fs; dp = ip->i_din2; easize = dp->di_extsize; + if ((uoff_t)easize + extra > NXADDR * fs->fs_bsize) + return (EFBIG); eae = malloc(easize + extra, M_TEMP, M_WAITOK); |